Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Shubham Vora
793 articles
Python Program for Convert characters of a string to opposite case
In this problem, we will toggle the case of each string character. The easiest way to toggle the case of each string character is using the swapcase() built-in method. Also, we can use the ASCII values of the characters to swap their case. Python also contains isupper() and islower() methods to check the character's case and the lower() and upper() methods to change the case. Problem statement − We have given a string. We need to toggle the case of string characters. It means converting uppercase characters to lowercase and lowercase characters to uppercase. Sample Examples ...
Read MorePython3 Program for Longest subsequence of a number having same left and right rotation
In this problem, we will find the length of the longest subsequence of a given numeric string such that it has the same left and right rotation. A string has the same left and right rotation when rotating left by one position produces the same result as rotating right by one position. We can solve this problem using two approaches: generating all subsequences and checking rotations, or using an optimized observation-based method that recognizes patterns in valid subsequences. Problem Statement Given a numeric string, find the size of the longest subsequence that has the same left and ...
Read MorePython3 Program to Find Maximum number of 0s placed consecutively at the start and end in any rotation of a Binary String
In this problem, we need to find the maximum sum of consecutive zeros at the start and end of any rotation of a binary string. We can solve this using two approaches: generating all rotations or using an optimized observation-based method. Problem Statement − Find the total number of maximum consecutive zeros at the start and end of any rotation of the given binary string. Examples Example 1 binary_str = "00100100" print(f"Input: {binary_str}") Input: 00100100 Output: 4 Explanation − Let's examine all rotations: 00100100 − Starting zeros: 2, ...
Read MorePython3 Program for Queries for Rotation and Kth Character of the given String in Constant Time
In this problem, we need to perform queries on a string efficiently. We'll handle two types of queries: left rotation and character access. We'll explore two approaches - a straightforward string manipulation method and an optimized pointer-based solution. Problem Statement Given a string and an array of queries, perform operations based on query types ? (1, l) − Perform left rotation of the string l times (2, l) − Access and print the character at position l (1-indexed) Example Let's see how the queries work with a sample input ? # ...
Read MoreComputer Network - Definition, Components, Objectives
A computer network is a collection of interconnected computing devices that can exchange data and share resources with each other. These networked devices use standardized rules called communication protocols to transmit information over physical or wireless connections. Computer networks enable distributed processing where tasks are divided among multiple computers rather than being handled by a single machine. This collaborative approach allows organizations to achieve greater efficiency, resource sharing, and scalability across different locations. Basic Computer Network Structure Client Client ...
Read MoreHow Does the Access-Control-Allow-Origin Header Work?
The Access-Control-Allow-Origin header is a fundamental component of Cross-Origin Resource Sharing (CORS) that enables web browsers to safely allow websites from one origin to request resources from another origin. An origin consists of three components: protocol (scheme), hostname, and port. For example, https://www.tutorialspoint.com:443 represents a complete origin, not just the hostname. How CORS Works CORS uses HTTP headers to inform browsers which origins are permitted to access resources from a server. Here's how the process works: Origin A (e.g., https://www.tutorialspoint.com) wants to request resources from Origin B (e.g., http://api.example.com) The browser blocks ...
Read MoreWhat are Max parallel HTTP connections in a browser?
In this tutorial, we will learn about Max parallel HTTP connections in a browser and how they impact web page loading performance. To understand this topic, we will explore what parallel connections are, the reasons behind connection blocking, browser limitations, and optimization strategies. What Are Parallel Connections? Instead of downloading embedded objects sequentially (original HTML page, first embedded item, second embedded object, etc.), browsers can establish multiple parallel connections to simultaneously carry out numerous HTTP transactions. Sequential vs Parallel HTTP Connections Sequential Loading ...
Read MoreHow to take HTML form data as text and send them to html2pdf?
The html2pdf is a JavaScript library that allows developers to convert HTML content to PDF format. It takes HTML elements as parameters and generates downloadable PDF documents. This library is particularly useful for creating reports, forms, and other documents from web page content. In this article, we will learn how to capture HTML form data and convert it to PDF using the html2pdf library. We will explore different approaches to include form data in PDF documents. Syntax Following is the basic syntax to convert HTML form data to PDF using html2pdf − var element = ...
Read MoreWhat can be done with style sheets that can not be accomplished with regular HTML ?
CSS stylesheets provide presentation and visual enhancements that go far beyond what regular HTML can accomplish. While HTML defines the structure and content of a web page, CSS controls the visual appearance, layout, animations, and responsive behavior that make modern websites attractive and functional. Why Stylesheets are Essential HTML alone can only create basic structure with limited presentation capabilities. Without CSS, web pages would appear as plain text with default browser styling. Stylesheets enable developers to create visually appealing, interactive, and responsive designs that enhance user experience significantly. The key advantages of using stylesheets include separation of ...
Read MoreTop 5 HTML Tricks That You Should Know
HTML continuously evolves with each new release, introducing powerful features that many developers overlook. These HTML tricks can significantly enhance your web pages and provide better user experiences without requiring complex JavaScript libraries or frameworks. Here are the top 5 HTML tricks that every developer should know, complete with practical examples and implementation details. Color Picker in HTML HTML5 provides a built-in color picker using the element with type="color". This creates a native color selection interface that allows users to pick colors visually or enter RGB/hex values directly. Syntax Following is the syntax to ...
Read More