Skip to content

Category Archives: Algorithms

Given an array arr[] consisting of N distinct integers and an array Q[][2] consisting of M queries of the form [L, R], the task for… Read More
Given the coordinates of the centers of two circles (X1, Y1) and (X2, Y2) as well as the radii of the respective circles R1 and… Read More
Given a string S of size N consisting of characters from ‘0’to ‘9’, the task is to minimize the length of the string where In… Read More
Given two arrays of strings containing words[] and queries[] having N and Q strings respectively, the task is to find the number of strings from… Read More
Given a value N, the task is to find the number of ways a binary string of size N can be formed such that at… Read More
Greedy algorithm, divide and conquer algorithm, and dynamic programming algorithm are three common algorithmic paradigms used to solve problems. Here’s a comparison among these algorithms:… Read More
Given two integers L and R, the task is to find the value of (number of composites – number of primes) that lie in the… Read More
Given a 2D array arr[][] where each array element denotes a point in the X axis and the number of elements on that point. A… Read More
Pattern searching is an algorithm that involves searching for patterns such as strings, words, images, etc. We use certain algorithms to do the search process.… Read More
Given three arrays arr1[], arr2[], and arr3[] consisting of non-negative integers. The task is to find the bitwise XOR of the XOR of all possible… Read More
A relation is a subset of the cartesian product of a set with another set. A relation contains ordered pairs of elements of the set… Read More
Given a string S consisting of only lowercase characters, the task is to find the lexicographically smallest string after removing exactly K characters from the… Read More
Two players, Player 1 and Player 2, are given an integer N to play a game. The rules of the game are as follows : … Read More
There are N persons and N jobs. Given an array arr[] of size N*N where (arr[0], arr[1], . . ., arr[N-1]) denotes the time taken… Read More