Skip to content

Category Archives: Greedy

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
Given an integer, N, the task is to find the maximum LCM (Least Common Multiple) that can be obtained from four numbers less than or… Read More
Given an integer N(N doesn’t contain zero at any index) along with X(1 ≤ X ≤ 9), the task is to find the minimum possible… Read More
Given two positive integer arrays X[] and Y[] of size N, Where all elements of X[] are distinct. Considering all the elements of X[] are… Read More
Given two arrays A[] and B[], the array C[] is formed by the XOR of ai and bi, i.e ci = ai^bi, the task is… Read More
Given two arrays arr[] and arr2[], and a value K, the task is to check whether the array arr[] can be made to all zeros… Read More
Given an Array A[] of size N with repeated elements and all array elements are positive, the task is to find the maximum sum by… Read More
Given a n*m binary matrix, the task is to make an equal number of 1’s in each row using the operation as follows: Choose any… Read More
Given two integers N and X. Find the maximum product of digits of N, such that increment any digit by 1 at most X times… Read More
Given array A[] of size N and integer X, the task is to find the minimum number of operations to make any two elements equal… Read More
Given an array arr[] of size N, the array represents N / 2 coordinates of a rectangle randomly shuffled with its X and Y coordinates.… Read More
Given a string str and an integer K, the task is to find the longest string that can be made by deleting letters from the… Read More

Start Your Coding Journey Now!