Range Sum Queries and Update with Square Root

Given an array A of N integers and number of queries Q. You have to answer two types of queries. Update [l, r] – for… Read More »

Area of a leaf inside a square

Given an integer a as the side of the square ABCD. The task is to find the area of the leaf AECFA inside the square… Read More »

Check if words are sorted according to new order of alphabets

Given a sequence of Words and the Order of the alphabet. The order of the alphabet is some permutation of lowercase letters. The task is… Read More »

Smallest Greater (than S) String of length K whose letters are subset of S

Given a string S of length N consisting of lowercase English letters and an integer K. Find the lexicographically smallest string T of length K,… Read More »

Check if a number is Triperfect Number

Given a number . The tasks is to check if the given number is a Triperfect Number. Triperfect Number: A Number is a Triperfect Number… Read More »

Largest right circular cylinder within a frustum

Given a frustum of height , top-radius & base-radius . The task is to find the volume of biggest right circular cylinder that can be… Read More »

Largest right circular cylinder within a cube

Given a cube of side length a. The task is to find the volume of biggest right circular cylinder that can be inscribed within it.… Read More »

Area of a triangle inside a parallelogram

Given the base and height of the parallelogram ABCD are b and h respectively. The task is to calculate the area of the triangle ▲ABM… Read More »

Minimum and Maximum number of pairs in m teams of n people

There are people which are to be grouped into exactly teams such that there is at least one person in each team. All members of… Read More »

Larger of a^b or b^a (a raised to power b or b raised to power a)

Given two numbers , find which is greater . If , print a^b is greater If , print b^a is greater If , print Both… Read More »

Find the element whose multiplication with -1 makes array sum 0

Given an array of N integers. The task is to find the smallest index of an element such that when multiplied by -1 the sum… Read More »

Length of rope tied around three equal circles touching each other

Given r is the radius of three equal circles touching each other. The task is to find the length of the rope tied around the… Read More »

Check if item can be measured using a scale and some weights

Given some weights of masses a0, a1, a2, …, a100, a being an integer, and a weighing scale where weights can be put on both… Read More »

Number of Paths of Weight W in a K-ary tree

Given a K-ary tree, where each node is having K children and each edge has some weight. All the edges i.e. K, that goes from… Read More »

Number of triangles that can be formed with given N points

Given X and Y coordinates of N points on a Cartesian plane. The task is to find the number of possible triangles with the non-zero… Read More »