## Traversal of tree with k jumps allowed between nodes of same height

Consider a tree with n nodes and root. You can jump from one node to any other node on the same height a maximum of… Read More »

Consider a tree with n nodes and root. You can jump from one node to any other node on the same height a maximum of… Read More »

How to apply STL binary_search to vector of pairs(key, value), given that vector is sorted by its first value(key) struct compare in the code contains… Read More »

Vectors are known as dynamic arrays which can change its size automatically when an element is inserted or deleted. This storage is maintained by container.… Read More »

In C++, we can quickly find array product using accumulate() and multiplies(). Output: 750 product of vector Output: 750 We can also use a custom… Read More »

Given a set of N elements such that N, task is to generate an array such that the GCD of any subset of the generated… Read More »

There are n cores of processor. Each core can process a task at a time. Different cores can process different tasks simultaneously without affecting others.… Read More »

Given an integer N, task is to find the numbers which when raised to the power of 2 and added finally, gives the integer N.… Read More »

Given a matrix m[ ][ ] of size n x n consisting of integers and given a character ‘x’ indicating the direction. Value of ‘x’… Read More »

Euler tour tree (ETT) is a method for representing a rooted tree as a number sequence. When traversing the tree using Depth for search(DFS), insert… Read More »

Given an N-ary tree, find sum of all elements in it. Example : Input : Above tree Output : Sum is 536 Recommended : Please… Read More »

Given a set of N integers. Find how many subsets of given array have sum between A and B(inclusive). Constraints: 1 ≤ 34 ≤ N,… Read More »

Given a number n, find the ordered prime signatures and using this find the number of divisor of given n. Any positive integer, ‘n’ can… Read More »

Given a number K and a string S, We have to Find the lexicographically smallest string str of length K such that it’s set of… Read More »

Given two integers N and X. Make a number in such a way that the number contains the first and last digit occurring in .… Read More »