Given a binary matrix mat[][] of size NxM and two integers X and Y, the task is to find the minimum number steps required to… Read More

# Category Archives: Greedy

Given a string str of lowercase English alphabets, our task is to find the frequency of occurrence a subsequence of the string which occurs the… Read More

Given an unsorted array arr[] of N integers that are in Arithmetic Progression, the task is to print the missing element from the given series.… Read More

Given a permutation P of size N, having values from 1 to N. the task is to find the minimum number of adjacent swaps required… Read More

Given an N-sided regular polygon, we have connected all the vertices at the center of the polygon, thus dividing the polygon into N equal parts.… Read More

Given string str of length N, the task is to obtain the lexicographically largest string by at most one swap. Note: The swapping characters might… Read More

Given an array arr[] of length N with unique elements, the task is to find the length of the longest increasing subsequence that can be… Read More

Given an N * M matrix and a starting position (X, Y) of a virus, the task is to find out the number of covered… Read More

Given an array arr[] of length N, containing values in the range [1, N], the task is to find a subsequence s1, s2, …, sk… Read More

Given two strings S1 and S2 of length N and a positive integer K, the task is to find the lexicographically smallest string such that… Read More

Given a positive N, the task is to find the last two digits of 7N.Examples: Input: N = 5 Output: 07 Explanation: The value of 75 = 7… Read More

Given a matrix mat[][] with N rows and M columns. The task is to find the minimum number of changes required in the matrix such… Read More

Given a number N, print all the Strong Numbers less than or equal to N. Strong number is a special number whose sum of the… Read More