Check if all elements of given Linked List corresponds to a downward path from any node in given Binary Tree
Given a root of the Binary Tree and head of the Linked List, the task is to check if all the elements of the linked list corresponds to a downward path from any node in the given Binary Tree....
read more
Count of subsets whose product is multiple of unique primes
Given an array arr[] of size N,  the task is to count the number of non-empty subsets whose product is equal to P1×P2×P3×……..×Pk  where P1, P2, P3, …….Pk are distinct prime numbers....
read more
Length of longest subset consisting of A 0s and B 1s from an array of strings
Given an array arr[] consisting of N binary strings, and two integers A and B, the task is to find the length of the longest subset consisting of at most A 0s and B 1s....
read more
Minimize steps required to make two values equal by repeated division by any of their prime factor which is less than M
Given three positive integers M, X, and Y, the task is to find the minimum number of operations required to make X and Y equal such that in each operation divide X or Y by one of its prime factor less than M. If it is not possible to make X and Y equal, then print “-1”....
read more
Count prime factors of N!
Given an integer N, the task is to count the number of prime factors of N!....
read more
Queries to count groups of N students possible having sum of ratings within given range
Given integers N and K representing the number of batches and number of students in each batch respectively, and a 2D array ratings[][] of size N * K where each row has ratings for every K students and Q queries of type {a, b}. The task for each query is to count the number of groups of N students possible by selecting a student from each batch, such that sum of ratings in each group lies in the range [a, b] inclusively....
read more
Check if a matrix contains a square submatrix with 0 as boundary element
Given an N*N binary matrix arr[][], the task is to check if the matrix contains a square of at least size 2 x 2 whose boundaries are made up of only 0s....
read more
Count of Binary strings of length N having atmost M consecutive 1s or 0s alternatively exactly K times
Given three integers, N, K and M. The task is to find out the number of binary strings of length N which always starts with 1, in which there can be at most M consecutive 1’s or 0’s and they alternate exactly K times.Examples:...
read more
Remove all the Even Digit Sum Nodes from a Circular Singly Linked List
Given a circular singly linked list containing N nodes, the task is to remove all the nodes from the list which contains elements whose digit sum is even....
read more
Count ways to reach the Nth stair using any step from the given array
Given N stairs and a person standing at the bottom wants to reach the top. He could climb any number of steps from the given array arr[] of positive integers. The task is to find the count of all possible ways to reach the top....
read more
Proto Van Emde Boas Tree | Set 2 | Construction
Van Emde Boas Tree supports search, minimum, maximum, successor, predecessor, insert and delete operations in O(lglgN) time which is faster than any of related data structures like priority queue, binary search tree, etc. Proto Van Emde Boas tree is similar prototype type data structure but it fails to achieve the complexity of O(lglgN), We will learn Proto Van Emde Boas tree first to get a basic understanding of working of Van Emde Boas tree. Here N is the size of the universe over which tree is defined....
read more
Maximum length of segments of 0’s and 1’s
Given a string comprising of ones and zeros. The task is to find the maximum length of the segments of string such that a number of 1 in each segment is greater than 0....
read more