Given an integer N. You can select any two digits from this number (the digits can be same but their positions should be different) and… Read More
Tag Archives: Constructive Algorithms
Given two integer arrays arr[] and cost[] where cost[i] is the cost of choosing arr[i]. The task is to choose a subset with at least… Read More
Given a String of three Colours(G, B, Y) as input, the task is to print the resultant combined color formed according to the rule given… Read More
Given a Natural number N and a whole number L, the task is to find the count of numbers, smaller than or equal to N,… Read More
Given a string consisting of only three possible characters ‘a’, ‘b’ or ‘c’. The task is to replace characters of the given string with ‘a’,… Read More
Given a number X, the task is to find the minimum number N such that the total set bits of all numbers from 1 to… Read More
Given two integers N and K where K < N, the task is to generate a permutation of integers from 1 to N such that… Read More
Given an array of N integers and 3 integers D, A and B. The task is to find the number of array elements that we… Read More
Given a linked list. The task is to change the value of the previous and next node of a node to 0 if the current… Read More
Given an array arr[] having 4 integer digits only. The task is to return the maximum 24 hour time that can be formed using the… Read More
Given three integers A, B and X. The task is to construct a binary string str which has exactly A number of 0’s and B… Read More
Given a Binary String of length . It is allowed to do at most one swap between any 0 and 1. The task is to find… Read More
Given an array containing N elements and an integer K. It is allowed to perform the following operation any number of times on the given… Read More
Given a binary string consisting only of 1’s and 0’s. Find the bit (output is either 1 or 0)whose minimum number of contiguous sequence flips… Read More