Skip to content

Category Archives: Greedy

Given a string S of length N containing only lowercase alphabets, also given a permutation P of length N containing integers from 0 to N-1.… Read More
Given an array arr[] of size N, the task is to make array arr[] sorted in non-decreasing order in the minimum number of operations where… Read More
Given two positive integers N (N>1) and K, the task is to output such permutation and the minimum value of Z/K, considering the below conditions:… Read More
Best-first search is what the AO* algorithm does. The AO* method divides any given difficult problem into a smaller group of problems that are then… Read More
Given a grid of size, 2 rows * N columns and array Q[][2] of size M, the task for this problem is to check traversal… Read More
Given a circular connected array consisting of elements from 1 to n. Starting from 1st element, you can jump from any element to any other… Read More
Given the array X[],   the task is to return the maximum suffix sub-array length of the same elements for each distinct element and the… Read More
Given an array X[] of length N. In each operation, the following task is performed: Decrement any value by 1. Replace any pair with their… Read More
Given an array arr[] of length N. Find a positive integer K such that the difference between any pair of array elements is not a… Read More
Given an integer N, denoting the size of a circular array containing non-zero elements and an array arr[] of size M having the indices of… Read More
Given a matrix mat[][] of size N * N, where mat[i][j] represents the time taken to reach from ith city to jth city. Also, given… Read More
Given an array arr[], the task is to find the maximum sum possible such that any subarray of the indices from [l, r] i.e all… Read More
Given an array vals[] of size N, where each element represents the value of each node (0 ≤ index ≤ N-1) and an array Edges[]… Read More
Given an array arr[] with size N, the task is to find the minimum possible sum of distinct elements over all the prefixes of the… Read More
Given an array arr[] of size N that denotes the type of an element, and another time array time[] of size N where time[i] denotes… Read More

Start Your Coding Journey Now!