Skip to content

Category Archives: Greedy

Given a strictly increasing array A of positive integers where,    . The task is to find the length of the longest Fibonacci-like subsequence of… Read More
Given an array A containing n integers. The task is to check whether the array is Monotonic or not. An array is monotonic if it… Read More
Given cost of the ticket ’25’ and an integer array ‘arr’ which holds the values of the notes people in a queue are having (either… Read More
Given total number of candies ‘X’, number of students ‘N’ and an array ‘arr’ which holds the value for the exact number of candies that… Read More
Given two integers ‘X’ and ‘N’, the task is to split the integer ‘X’ into exactly ‘N’ parts such that: X1 + X2 + X3 +… Read More
Given N glasses having water, and a list A of each of their capacity. The task is to find the minimum number of bottles required… Read More
Given a positive coordinate ‘X’ and you are at coordinate ‘0’, the task is to find the minimum time required to get to coordinate ‘X’… Read More
You are given a binary string of even length and equal number of 0’s and 1’s. What is the minimum number of swaps to make… Read More
Given a string S. The task is to print the K-th lexicographically the smallest one among the different substrings of s.A substring of s is… Read More
Given an array A of n integers and integer X. You may choose any integer between , and add k to A[i] for each . The task… Read More
Given an array of elements ‘arr’, the task is to maximise the sum of the elements of this array after performing the following operation: You can… Read More
Given two strings and . Find the longest common prefix between them after performing zero or more operations on string . In each operation, you can swap any… Read More
Given a range [L, R], the task is to find all possible co-prime pairs from the range such that an element doesn’t appear in more… Read More
Given 3 integers K, P and N. Where, K is the number of problems given to the person every day and P is the maximum… Read More
Given a string str, the task is to check if it can be rearranged to get a special palindromic string. If we can make it… Read More