Category Archives: Greedy

Given an integer N(N > 1), the task is to arrange all integers from the range [1, N] in an array such that none of… Read More
Given an integer N, the task for two players A and B is to make the value of X ( initialized with 1) at least… Read More
Given two strings S1 and S2, the task is to check if string S1 can be made equal to string S2 by swapping any pair… Read More
Given a string, S, the task is to find the maximum number of distinct indexed palindromic subsequences of length 3 possible from the given string.… Read More
Given two positive integers X and Y, the task is to count pairs with even sum possible by choosing any integer from the range 1… Read More
Given a positive integer N, the task is to construct an array of length N and find the maximize the value at index K such… Read More
Given the integers N, M, R and C where N and M denotes the number of rows and columns in a matrix and (R, C)… Read More
Given an array of integers, arr[] of size N, the task is to print all possible sum at each valid index, that can be obtained… Read More
Given two arrays arr1[] and arr2[] consisting of N and M integers respectively, and two integers X and Y, the task is to check if… Read More
Given an array arr[] of size N, the task is to split the array into two subsets such that the Bitwise XOR between the maximum… Read More
Given an integer D, the task is to find the count of all possible positive integers N such that reverse(N) = N + D. Examples:… Read More
Given two arrays arr[] and brr[] of size N and M respectively, the task is to count the maximum number of elements that can be… Read More
Given an array arr[] consisting of N positive integers, the task is to left-shift the digits of array elements such that the array modifies to… Read More
Given a binary array arr[] of size N, the task is to find the maximum count of 0s that can be converted into 1s such… Read More
Given two integers N and K, the task is to find whether it is possible to represent N as the sum of exactly K powers… Read More