Given binary string str, the task is to find the minimum number of characters required to be flipped to make all 1s in right and… Read More

# Category Archives: Greedy

Given an array A[] of size N, the task is to find the maximum length of the longest non-decreasing array that can be generated from… Read More

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

Given an array arr[] having N distinct positive elements, the task is to generate another array B[] such that, for every ith index in the… Read More

Given an array arr[] containing a permutation of first N natural numbers. In one operation, remove a pair (X, Y) from the array and insert… Read More

Given an integer N, the task is to find all non-negative pairs (A, B) such that the sum of Bitwise OR and Bitwise AND of… Read More

Given integers N, K, A, and B, check if it is possible to reach B from A in a circular queue of integers from 1… Read More

Given integer N and integer S, the task is to find the smallest number greater than or equal to N such that the sum of… Read More

Given a 2D array arr[][], where each row is of the form {start, end} representing the start and endpoints of each line segment on the… Read More

Given an integer N, the task is to count the number of pairs of prime numbers in the range [1, N] such that the difference… Read More

Given an array arr[], the task is to find the length of the longest subsequence of the array arr[] such that all adjacent elements in… Read More