Python regular expressions (regex) provide various ways to handle whitespaces, including spaces, tabs, and newline characters, which can be effectively stripped from strings using regex. This article will explain how to split a string on newline characters using different regular expressions, following are the various methods to achieve the present task. Using re.split(r"[]", text) Splitting on One or More Newlines Using Quantifier [+] Splitting on Newlines with Whitespace Using re.split(r"\s*", text) Using re.split(r"[]", text) The re.split() function splits a string wherever the specified regular expression pattern ... Read More
A JAR file is like a ZIP file but for Java code. For the packaging of multiple class files, Java provides a file format known as JAR (Java Archive). Typically, a JAR file contains .class files, images, text files, and libraries in a single file that are required to execute the Java application or library. This file format is used to distribute application software and libraries in Java. All the predefined libraries are available in this format. If you have any library in JAR format, to use it in your application, you either need to place it in the current folder ... Read More
If you’ve been coding in Java for some time, you might have wondered why you can't make an enum extend another class. It seems like it should, but Java won't let you. Let's break down why this happens Enumeration in Java Enumeration (enum) in Java is a user-defined datatype which stores a set of constant values. You can use enumerations to store fixed values such as days in a week, months in a year, and seasons, etc. If we had to store all seven days of a week into one single variable then we might tend to use data ... Read More
The interpolation search is an improved version of the binary search. The list is divided using the mid element in the binary search whereas the interpolation search algorithm tries to locate the exact position using the interpolation formula. For this algorithm to work properly, the data collection should be in a sorted form and equally distributed. In this article, we have a sorted array. Our task is to implement the interpolation search algorithm algorithm on this sorted array in C++. The formula used in this algorithm to find the position is given below: Interpolation Position Search Formula pos = ... Read More
In this problem, we are given an array of integers that may contain both positive and negative integers. We have to calculate the maximum sum of any contiguous subarray of the given array. In this article, we are going to learn how we can find the maximum subarray sum using the Kadane Algorithm using C#. Here is an example to find maximum sum in subarray: Example Input: arr = [1, -2, 3, 4, -1, 2, 1, -5, 4] Maximum Sum Subarray: [3, 4, -1, 2, 1] Sum = 3 + 4 + (-1) + 2 + 1 = 9 ... Read More
A string is a sequence of characters that can include alphabets, numbers, and symbols together or separately. In this article, we are going to learn how we can remove vowels from a given string in JavaScript using different approaches. There are a total of five vowels in the English alphabet. The five vowels in the English alphabet are: a, e, i, o, u, and they can be both uppercase or lowercase. Vowels are some specific alphabetic characters that represent specific speech sounds.There are a total of 5 vowels in 26 letters of the alphabet from A to Z, both ... Read More
In general, while reading or writing data to a file, you can do so, from the start of the file. You cannot read/write from random position. The java.io.RandomAccessFile class in Java enables you to read/write data to a random-access file. This acts similar to a large array of bytes where the cursor known as file pointer works like an index. With the help of file pointer you can get the position of this pointer using the getFilePointer() method and set it using the seek() method. RandomAccessFile Class: Reading Files This class provides various methods to read and write data ... Read More
What is an Array? An array in Python is a data structure that stores elements of the same type in a fixed size sequence. Different lists, arrays are more specified for numerical operations. Python uses the array module to create arrays. Arrays determine indexing and iteration. How to Convert a Python Tuple to an Array? To convert a Python tuple to an array, we can use the array module or numpy. Using array, imports array from the module and passes the type code and tuple. With NumPy, import numpy and use numpy.array(tuple). This converts the tuple into a mutable array, ... Read More
The Bitwise AND (&) Operator is one of the types of bitwise operators, which perform operations on bits of a binary representation. The Bitwise AND (&) compares each bit of the first operand to the corresponding bit of the second operand and returns 1 if both bits are 1, else returns 0 if either or both bits are 0.You can think of it as similar to multiplication in decimal, like 1 * 1 = 1, and all other combinations result in 0. But ensure that both operands are of integral data types (as it works with binary representations) like int, ... Read More
The term "Quick Commerce", describes extremely fast distribution services that guarantee distribution of goods of 10 to 30 minutes, usually grocery articles, everyday requirements and small electronics. With speed, convenience and immediate customer requirements, the next step in the development of e-commerce symbolizes. To continue this change, industries such as Blinkit, Zepto and Swiggy Instamart, are changing how consumers act and see what they demand from retailers.How Quick Commerce Is Changing the Retail Industry?Changing Expectations of Consumers: Nowadays, speed is a key distinction. Customers no longer wait for delivery for days or hours, they now want them in minutes.Growth of ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP