Introduction Josephus’ problem is a mathematical counting-out problem and claims that it originates from an incident in the first century when the Jewish revolted against Rome. When they saw that they couldn’t stand against the Roman army, Historian Flavius Josephus ...

Introduction Let’s learn today about an efficient Searching Algorithm, i.e., Binary Search. It is also known as half interval search, logarithmic search, and binary chop.   It is a searching algorithm that helps find the element in the array and return ...

Introduction  Before getting started, let’s visualise an example that will help you understand Array’s use case in Python. Imagine you have been told to keep the count of the Bitcoin market prices during the pandemic. What will you do? Will ...

Introduction Let’s start with reading the problem statement of Stock Span –  You are given a list of stock prices of “n” days, and you need to find the span of each stock’s price for all the “n” days.  Consider ...

Introduction In this blog, you learn to solve the problem Longest Consecutive Subsequence. But before that, you need to be very clear about the definition of subsequence. Most of the people remain confused between subarray and subsequence, so let’s discuss ...

Introduction Finding substrings and subsequences are popular topics in programming job interviews, along with array, binary tree, and linked list data structures. Today we will look at a problem called “Longest Palindromic Substring,” frequently asked in product companies such as ...

Introduction Let’s say you have an array of n numbers, and this array can contain numbers from 0 to n-1. And for the numbers up to n, which are not present in the array, it has -1.  Now we have ...

Introduction The nodes of the singly linked list contain two important pieces of information—first, the value they hold, and second, the pointer to the next node. The second property forms the basis for the traversal of a singly linked list. ...

Introduction This blog will discuss the operations that we can perform on Arrays in C/C++ programming languages. If you have prior knowledge of Arrays, you may proceed further. Okay, now let’s get started with Operations on Arrays in C/C++. Operations ...

Introduction The longest common subsequence (LCS) is defined as the longest subsequence that is common to all the given sequences, provided that the elements of the subsequence are not required to occupy consecutive positions within the original sequences. Note: Subsequence ...