# Category Archives: Algorithms

Find the number of leaf nodes in a perfect N-ary tree of height K. Note: As the answer can be very large, return the answer… Read More
Given two integers N and X, the task is to convert 1 to N using minimum operations of any of the following operations: Change a… Read More
Given a binary matrix arr[][] of N rows and M columns. The task is to find the number of cells in the matrix, where Bitwise… Read More
Given an empty array A[] & Q queries of two types 1 and 2 represented by queries1 and queries2 respectively, the task is to find… Read More
Given a 3D array of size N*M*P consisting only of English alphabet characters, the task is to print the frequency of all the elements in… Read More
Given an array arr[], integer M and an array query[] containing Q queries, the task is to find the query[i]th occurrence of Mth most frequent… Read More
Given an integer N, the task is to find two pairs of positive integers such that the GCD of the first pair is the same… Read More
Given an array arr[] containing N positive integers, the task is to add an integer such that the bitwise Xor of the new array becomes… Read More
Given two positive integers, X and Y, the task is to find the minimum number of operations to make X and y equal where in… Read More
Given a number X, and an array arr[] of length N containing the N numbers. The task is to find the minimum number of operations… Read More
Given an integer N and the task is to generate a permutation of the numbers in range [1, N] such that:  The GCD of all… Read More
Given a stack of M elements and a queue of N elements in sorted order. The task is to find out the common elements of… Read More
Given an array arr[] of N integers and an integer K, the task is to do the below operations with this array K times. Operations… Read More
Given an array arr[] of length N containing non negative integers, the task is to find the last remaining element after performing the following operations… Read More
Given two strings T1 and T2 representing two time instances in 24-hour formats, the task is to convert T1 to T2 using a minimum number… Read More