## 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 »

- Sorting a vector in C++
- vector insert() function in C++ STL
- Merge k sorted arrays | Set 2 (Different Sized Arrays)
- Check if a given graph is Bipartite using DFS
- Longest subarray having average greater than or equal to x
- LFU (Least Frequently Used) Cache Implementation
- vector rbegin() and rend() function in C++ STL
- Minimum number of swaps required to sort an array | Set 2
- vector emplace() function in C++ STL
- Minimum cost path from source node to destination node via an intermediate node
- Advantages of vector over array in C++
- Count unique subsequences of length K
- vector data() function in C++ STL
- How does a vector work in C++?
- vector capacity() function in C++ STL
- Check if a triplet with given sum exists in BST
- Perform the given queries on the rooted tree
- Find the missing elements from 1 to M in given N ranges | Set-2
- vector shrink_to_fit() function in C++ STL
- vector max_size() function in C++ STL
- Print all pairs in an unsorted array with equal sum
- Lowest Common Ancestor in Parent Array Representation
- Print the DFS traversal step-wise (Backtracking also)
- Minimum number of days required to complete the work
- Count the number of elements in an array which are divisible by k
- Print levels with odd number of nodes and even number of nodes
- Program to print last N lines | Set-2
- Sorting array elements with set bits equal to K
- Delete array element in given index range [L - R]
- Count subarrays with Prime sum

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(). [sourcecode language=”CPP”] // C++ program to find array product #include <iostream> #include <numeric>… 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 »