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....
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....
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....
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”....
Given an integer N, the task is to count the number of prime factors of N!....
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....
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....
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:...
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....
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....
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....
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....