Delete Nodes And Return Forest
Problem Given a binary tree and a list of nodes. Return the forest after removing the given node…
How to shuffle list in Python using random.shuffle() function?
In this Python tutorial, we will discuss the different functions and methods provided by the Python…
Modular Exponentiation in Logarithmic Time
Problem Given three integers, a, b, and p. Compute the value of (ab)%p. Sample Input a =…
Count subarrays with given XOR
Problem Given an array of integers, count the number of subarrays that have the XOR equal to &ls…
Longest Consecutive Sequence in Linear time
Problem Given an array of integers. Find the length of the longest possible sequence from the ar…
Find dropping point of an egg
Problem You are given a 2-D grid where each cell has a value of either 1 or -1. Each cell in the…
Find K-th Smallest Element in BST
Problem Given a Binary Search Tree, find the k-th smallest element in the BST. Sample Input …
Find the count of distinct elements in every subarray of size k
Problem Given an array of integers and a number k. Find the count of distinct elements in every …
Partition an array into two subarrays with the same sum
Problem Given an array of integers greater than zero, find if it is possible to split it into tw…
Find the closest pair from two arrays
Problem Given two sorted arrays and an integer X, find one number from each array such that the …
Find all symmetric pairs in an array of pairs
Problem Given an array of pairs, find all symmetric pairs in it. Symmetric pairs are two pairs (…
Find two numbers with maximum sum formed by array digits
Problem Given an integer array having digits between 0 and 9, find two numbers with maximum sum …