Find the top K items with the highest value

Given a list of items and their values. The task is to find top k items with the highest value. It is possible that two… Read More »

Check if it is possible to move from (a, 0) to (b, 0) with given jumps

Given two points i.e. (a, 0) to (b, 0). The task is to check whether it is possible to move from (a,0) to (b,0) or… Read More »

Number of special pairs possible from the given two numbers

Given two numbers A, B. The task is to find the numbers of special pairs of A, B. A special pair of two numbers A,… Read More »

Length of the longest Subarray with only Even Elements

Given an array arr[]. The task is to find the length of the longest subarray of arr[] such that it contains only even elements. Examples:… Read More »

Find Largest Special Prime which is less than or equal to a given number

Given a number N. The task is to find the largest special prime which is less than or equal to N. A special prime is… Read More »

Check if an integer can be expressed as a sum of two semi-primes

Given a positive integer N, check if it can be expressed as a sum of two semi-primes or not. Semi-primes A number is said to… Read More »

Next greater number than N with exactly one bit different in binary representation of N

Given a number N. The task is to find the smallest number which is greater than N and has only one bit different in the… Read More »

A competitive programmer’s interview

How long have u been a competitive programmer? About 9 years. Top two websites you prefer to compete? Codingame, Topcoder What are some of the… Read More »

Understanding The Coin Change Problem With Dynamic Programming

The Coin Change Problem is considered by many to be essential to understanding the paradigm of programming known as Dynamic Programming. The two often are… Read More »

Queries for number of elements on right and left

Given Q queries of three types where every query consists of a number. Add element num on the left Add element num on the right… Read More »

Rearrange the string to maximize the number of palindromic substrings

Given a string S consisting of lowercase characters(a-z) only, the task is to print a new string by rearranging the string in such a way… Read More »

Queries to add, remove and return the difference of maximum and minimum.

Given Q queries. The queries are of three types and are described below: Add the number num to the list. Remove the number num from… Read More »

Find ‘N’ number of solutions with the given inequality equations

Find the value of a1, a2, a3, ….an such that the following two conditions are satisfied. Print the value of a1, a2, …, an and… Read More »

Number of balanced bracket subsequence of length 2 and 4

Given a bracket sequence of even length. The task is to find how many ways are there to make balanced bracket subsequences from the given… Read More »

Number of different positions where a person can stand

A person stands in line of n people, but he doesn’t know exactly which position he occupies. He can say that there are no less… Read More »