Skip to content

Category Archives: Algorithms

Given an N*M (N + M ≤ 40)matrix mat[][], each cell has some value ranging from 0 to 1018 and an integer  K. Find the… Read More
Given an array arr[] of length N. The task is to find the length of the longest subsequence of the array such that the absolute… Read More
Given a string str of length N, and an integer K, the task is to form K different strings by choosing characters from the given… Read More
Given three integers N, K and X. The task is to construct an array of size N where MEX of every K sized subarray is… Read More
Given an integer N count the number of values of X such that  X⊕N > N, where  ⊕ denotes bitwise  XOR operation Examples: Input: N =… Read More
Given an array arr[] containing N integers where 0 ≤ A[ i ] ≤ N,  the task is to divide the array into two equal… Read More
Given a sentence S and a string B having distinct characters, find a string by joining the words of S according to given conditions:- Choose… Read More
Given an array A of size N, having each element either 0 or 1 and an integer K. Find the minimum number of elements that… Read More
Given an integer N. Find the maximum length sequence containing distinct even integers with sum N. In case, such a sequence does not exist, return… Read More
Given the initial congestion window size cwnd, threshold value ssthresh, connection time rtt and an array arr where arr[i] implies the time when a packet… Read More
Given a binary tree of N nodes. Count the frequency of an integer K in the binary tree. Examples:  Input: N = 7, K =… Read More
Given two arrays a[] and b[] and an integer K, the task is to find the length of the longest common subsequence such that sum… Read More
Given an array arr of integers of size N, the task is to find a subsequence in which upon reversing the order, the maximum sum… Read More
Given a binary tree having N nodes, the task is to find the level having the maximum number of setbits. Note: If two levels have… Read More
Given an array arr (1-based indexing) of length N and an integer X, the task is to find and print all index ranges having a… Read More

Start Your Coding Journey Now!