Skip to content

Category Archives: Algorithms

Given a matrix of dimension N*N whose all cells are initially 0. You are given Q queries, each of type {a, b, c, d} where… Read More
Given a string S of length N, the task is to find two non-intersecting strings of equal length such that the sum of absolute differences… Read More
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: Greedy algorithm is defined as a method for solving optimization problems by taking decisions that result in the most evident and immediate benefit… 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

Start Your Coding Journey Now!