# Category Archives: Algorithms

Given an array arr[] of size N, an integer K and Q queries, each of form {x, l, r}. For each query, the task is… Read More
Given an integer N, the task is to generate an array arr[] having N positive integers such that arr[i] ≠ arr[j] if j is divisible… Read More
Given integers L and R, the task is to find the number of integers in range [L, R] (say X) which does not form a… Read More
Given an array A[] of size N and a digit K. Find the number of sub-sequences of the array where the last digit of the… Read More
Given an integer K, the task is to find three distinct integers A, B and C such that  ( A ∣ B ) & (… Read More
Given a positive integer N. Find the minimum number of operations needed to reduce N to 0 when N can reduced by its divisor at… Read More
Given two integers N, Y, generate a permutation of length N such that sum of all prefix minimum of that permutation is Y. Example:  Input:… Read More
Given integers N and K, the task is to find the number of factors of NCK. Since the answer can be very large return the… Read More
Given the root of a binary tree in which all nodes has values either 0 or 1, the task is to check if the level-wise… Read More
Given an array A consisting of N integers and an integer K, the task is to minimize the length of array A, by applying absorptions… Read More
Consider an integer sequence S, which is initially empty (i.e. S = {}). Also given are Q queries, each of which is one of the… Read More
Given a matrix mat[][] of size N * M and an integer K, the task is to find a path from the top-left cell (0,… Read More
Given an array arr[] of size N and an integer K, the task is to find the size of the largest subset possible having a… Read More
Given a singly linked list, and an integer K, the task is to make the first node value as minimum as possible in K operations… Read More
Given an array A[] containing N integers and another array M[] containing alternate values of all digits from 0 to 9 (i.e; M[i] = j… Read More