# Category Archives: Algorithms

Given a positive integer N denoting the number of astronauts(labelled from 0 from (N – 1))and a matrix mat[][] containing the pairs of astronauts that… Read More
Given an array, arr[] consisting of N integers, the task is to print the single integer value obtained by joining the array elements. Examples:  … Read More
Given an integer N, the task is to print the count of all the non-negative integers K less than or equal to N, such that… Read More
Given a sorted array arr[] of the first N Natural Numbers and an integer X, the task is to print the last remaining element after… Read More
Given a string S of length N, where each character of the string is either equal to ‘L’, ‘R’ or ‘?’, the task is to… Read More
Given an array arr[] consisting of N pairs, where each pair represents a query of the form {L, R}, the task is to find the… Read More
Given two integers A and B, the task is to find the minimum number of moves needed to make A equal to B by incrementing… Read More
Given a matrix arr[][] of dimension M*N consisting of positive integers, where arr[i][j] represents the height of each unit cell, the task is to find… Read More
The shortest path problem is the problem of finding a path between two vertices (or nodes) in a graph such that the sum of the… Read More
Given a sac of capacity W, and two arrays A[] and B[] of length N, where A[i] represents the weight of an ith block of… Read More
Given N persons are standing in a circle and an integer K. If initially starting from the first position, the Kth alive person clockwise from… Read More
Given an array, arr[] of N integers, the task is to find the maximum possible count of adjacent pairs with an even sum, rearranging the… Read More
Given a matrix mat[][] of size N×M where each row of the matrix is a permutation of the elements from [1, M], the task is… Read More
Given N non-intersecting nested polygons, and a 2D array arr[][] of pairs, where each cell of the array represents the coordinates of the vertices of… Read More
Given an array of strings, arr[] of size N and a string S, the task is to find if it is possible to map integers… Read More