Algorithms Largest sub-array with equal number of 1 and 0 In this article, we have explored 3 different approaches to find the Largest sub-array with equal number of 1 and 0. This involve the concept of Hash Map/ Set and Prefix Sum.
prefix sum array Corporate Flight Bookings problem [Solved] In this article, we will solve Corporate Flight Bookings problem using prefix sum algorithm. In naïve approach, it will take a quadratic O(N^2) time complexity but using a prefix sum approach we can get better time complexity.
Interview Problems on Array Car Pooling Problem In this article, we have explored the Car Pooling Problem in depth and presented an efficient approach to solve it using the concept of Prefix Sum.
Algorithms Number of Substrings in String of 0s and 1s that have K 1s In this article, we have explored algorithm to find the Number of Substrings in a String of 0's and 1's that have 'K' number of 1's.
Data Structures Data Structure with insert and product of last K elements operations We have presented 2 designs for Data Structure with insert and product of last K elements operations. Both operations can be done in constant time O(1).
List of Mathematical Algorithms Equilibrium Index: Find index such that sum of left sub-array = right sub-array For a given array, we need to find an index such that sum of left sub-array = right sub-array also called the Equilibrium Index. We solve this using brute force approach O(N^2) and using prefix array in linear O(N) time.
Algorithms Tile Stacking Problem We demonstrate how we will reduce the time complexity from O((k+1)^(m+1)) to O(N * M * K) to O(N * M). We have infinite number of tiles of sizes 1 to m. The task is calculate the number of different stable tower of height n with restriction that you can use at most k tiles of each size in the tower
Data Structures Prefix sum array Prefix Sum array is a data structure design which helps us to answer several queries such as sum in a given range in constant time which would otherwise take linear time. It requires a linear time preprocessing and is widely used due to its simplicity and effectiveness.