Skip to content

Category Archives: Divide and Conquer

QuickSort is a popular sorting technique based on divide and conquer algorithm. In this technique, an element is chosen as a pivot and the array… Read More
Given a valid parenthesis string S, the task is to find the weight of parenthesis based on the following conditions: Weight of “( )” is… Read More
Given an array arr[] of N numbers. We can merge two adjacent numbers into one and the cost of merging the two numbers is equal… Read More
Given an array arr[] of N integers both positive and negative, our task is to find the number of unordered pairs (x, y) which satisfy… Read More
Given a positive integer N and K, the task is to divide N into K parts such that the first part has a value X,… Read More
Given N number of people, the task is to count the number of ways to form groups of size ? N where, in each group,… Read More
Given two arrays arr1[] and arr2[]. The array arr1[] is sorted. The task is to print the change in the median after removing each element… Read More
Given an integer N, the task is to find the N-th Fibonacci numbers. Examples: Input: N = 3 Output: 2 Explanation: F(1) = 1, F(2)… Read More
Given an array arr[] of size N containing integers. The task is to find the length of the longest sub-array having sum equal to the… Read More
Given a string str and an integer K, the task is to find the length of the longest sub-string S such that every character in… Read More
Given a sorted array arr[], and a set Q having M queries, where each query has values X and Y, the task is to find… Read More
Given an array arr[] of N integers, the task is to delete the element from the given array if element to it’s left is smaller… Read More
Given two strings S1 and S2 of equal length, the task is to determine if S2 is a scrambled form of S1.Scrambled string: Given string str,… Read More