# Category Archives: Algorithms

## Smallest number greater than X which is K-periodic

Given a string integer X consisting of N digits and an integer K, the task is to find the smallest integer greater than or equal… Read More »

## The Skyline Problem | Set 2

Given n rectangular buildings in a 2-dimensional city, computes the skyline of these buildings, eliminating hidden lines. The main task is to view buildings from… Read More »

## Color a grid such that all same color cells are connected either horizontally or vertically

Given three integers R, C, N, and an array arr[] of size N. The task is to color all cells of a grid of R… Read More »

## Cost of creating smallest subsequence with sum of difference between adjacent elements maximum

Given two array of N integers arr[] and costArray[], representing removal cost associated with each element. The task is to find the subsequence from the… Read More »

## Check if a given string is a Reverse Bitonic String or not

Given a string str, the task is to check if that string is a Reverse Bitonic string or not. If the string str is reverse… Read More »

## Check if the given point lies inside given N points of a Convex Polygon

Given coordinates of the N points of a Convex Polygon. The task is to check if the given point (X, Y) lies inside the polygon.… Read More »

## Count of natural numbers in range [L, R] which are relatively prime with N

Given three integers N, L, and R. The task is to calculate the number of natural numbers in the range [L, R] (both inclusive) which… Read More »

## Check if a number is binary or not in Java

Given a number N, the task is to check first whether the given number is binary or not and its value should be greater than… Read More »

## C/C++ Program to find Prime Numbers between given range

Given two numbers L and R, the task is to find the prime numbers between L and R. Examples: Input: L = 1, R =… Read More »

## Maximum time such that absolute difference between hour and minute lies in given range

Given a 24-hour time value, where on some numbers are question marks( ‘?’ ), and two integers L and R. The question mark can be… Read More »

## Coprime divisors of a number

Given an integer N. The task is to find a pair of co-prime divisors of N, greater than 1. If such divisors don’t exists then… Read More »

## How to check if string contains only digits in Java

Given a string str, the task is to write a Java program to check whether a string contains only digits or not. If so, then… Read More »

## Smallest number greater than Y with sum of digits equal to X

Given two integers X and Y, find the minimal number with the sum of digits X, which is strictly greater than Y. Examples: Input: X… Read More »

## Find if there is a path between two vertices in a directed graph | Set 2

Given a Directed Graph and two vertices in it, check whether there is a path from the first given vertex to second. Example: Consider the… Read More »

## Print all possible paths in a DAG from vertex whose indegree is 0

Given a Directed Acyclic Graph (DAG), having N vertices and M edges, The task is to print all path starting from vertex whose in-degree is… Read More »