# Category Archives: Algorithms

Given two arrays A[] and B[] of N integers, the task is to find for each element A[i], the size of the smallest subset S… Read More
Given an array arr[]of integers with length N and an integer X, the task is to calculate the number of subarrays with median greater than… Read More
Given two arrays A[] and B[] with size N and M, the task is to find the minimum number of swaps between two arrays (can… Read More
Given an integer N, Find 4 points in a 2D plane having integral coordinates, such that the Manhattan distance between any pair of points is… Read More
Given positive integers, X, Y, and N, the task is to check whether X can be made equal to Y in exactly N operations wherein… Read More
Given an array arr[] and integer K, the task is to count the number of subsequences of the array such that after adding all the… Read More
Given an array arr[] of size N, the task is to count the minimum number of elements required to be removed from the given array… Read More
Given an array arr[] of N integers, the task is to divide find all the indices such that prefix sum (i.e. sum of elements in… Read More
Given an array arr[] of size N (multiple of 8) where the values in the array will be in the range [a, (a+8*N) -1] (a… Read More
Given an array arr[] containing N integers and an integer K, the task is to minimize the subset-sum difference after removing K elements from the… Read More
Given a binary string str of size N containing 0 and 1 only, the task is to count all possible distinct binary strings when a… Read More
Given an array arr[] of size N, and integers K and D, consisting of breakpoints in journey, the task is to find the distance covered… Read More
Given an array A[] of N integers. Check if there exist 2 distinct sub-sequences X and Y of the given array, such that the sum… Read More
Given an integer N, the task is to generate a permutation from 1 to N such that the bitwise XOR of differences between adjacent elements… Read More
Given an integer N, the task is to generate an array of N distinct integers. Such that the GCD of all the elements of the… Read More