# Category Archives: Algorithms

To understand this let’s take a binary tree Binary tree If we conduct BFS in this tree: In level 0 there is one node in… Read More
BFS and DFS are two algorithms that we use for graph traversal. In both the algorithms we start from a node and iterate over the… Read More
Given an array A[] and M, the task is to check whether there exist M non-overlapping subarrays(non-empty) of A for which the average of the… Read More
Given an array arr[] of length N, two arrays start[] and end[] of size M each where {start[i], end[i]} denotes a subarray of arr[] and… Read More
Given an array of positive integer arr[] of length N and an integer Z, (Z > arr[i] for all 0 ≤ i ≤ N –… Read More
Dynamic Programming (DP) is defined as a technique that solves some particular type of problems in Polynomial Time. Dynamic Programming solutions are faster than the… Read More
Given an array of size N, each index has K amount of money, the target is to pick the maximum amount of money from the… Read More
Given 2 arrays num[] and cost[] containing the number of elements and the cost to buy that many elements respectively. {i.e. cost[i] is the cost… Read More
Given a sorted array arr[] of size N and integer K, the task is to split the array into K non-empty subarrays such that the… Read More
Given a string S of length N consisting of digits from ‘0’ to ‘9’ .The task is to determine the total number of possible ways… Read More
What is Amortization? Consider that you are a company owner and that you require a vehicle. The automobile is priced at €10, 000. You’ll have… Read More
Given an matrix mat[][] of size N*N (N > 2) such that mat[i][j] = arr[i]*arr[j] (where arr[] is a N sized array that is not… Read More
For N given cities, find how many ways a driver can traverse through them so that each town is visited exactly K times. From each… Read More
Given an integer N, the task is to generate an array A[] of length N such that it satisfies the following conditions for all 1… Read More
Given an array arr[] of N Positive integers, the task is to find the largest prefix sum which is also the suffix sum and prefix… Read More