Given binary string str, and integers A, which denotes the cost of converting consecutive 1s to 0s, and B, which denotes the cost of converting… Read More

# Category Archives: Searching

Given a 2D array arr[][] of the form {start, end} representing the start and end time of N meetings, also given two arrays entrance[] and… Read More

Given a sorted array, arr[] of size N representing the positions of the ith point on X-axis and an integer K, the task is to… Read More

Given an integer N which needs to be present as a value in a node in the last level of a Tree rooted at 1… Read More

Given an array arr[] consisting of N integers, the task for each array element arr[i] is to print the sum of |i – j| for… Read More

C++ filter_none edit close play_arrow link brightness_4 code // C++ program of the // above approach #include <cstring> #include <iostream> using namespace std;… Read More

Given a 2D array arr[][] consisting of N rows of the form {Xi, Yi, Ri} such that (Xi, Yi) represents the position of a tower… Read More

Given an array arr[] consisting of N integers. Two players, Player 1 and Player 2, play turn-by-turn in which one player can may either of… Read More

Given an array arr[] of size N, the task is to rearrange the array elements such that the count of local minima in the array… Read More

Given an array arr[] consisting of N non-negative distinct integers and an integer K, the task is to distribute the array in two arrays such… Read More

Given an array arr[] of size N, the task is to find the composite Fibonacci numbers present in the given array. Examples: Input: arr[] =… Read More

Given a matrix arr[][] of dimensions N * M, the task is to sort the matrix such that each row is sorted and the first… Read More

Given a string S of length N consisting of ‘x’ and ‘.’. The given string represents a row of seats where ‘x’ and ‘.’ represent… Read More

Given two strings S1 and S2, the task is to check if it’s possible to generate string S2 by repeatedly appending subsequences of S1 to… Read More