# Category Archives: Algorithm

## Number of bitonic arrays of length n and consisting of elements from 1 to n

For a given number n (n > 1), we need to find the number of ways you can make bitonic array of length n, consisting… Read More »

## Best meeting point in 2D binary array

You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in a group. And the group… Read More »

## Program to print table of a number

Given a number n as input, we need to print its table. Examples: EXAMPLE1: Input : 5 Output :5 * 1 = 5 5 *… Read More »

## Check if a grid can become row-wise and column-wise sorted after adjacent swaps

Given a grid of size n x len filled with lowercase characters. We can swap two adjacent characters in the same row and column. Now… Read More »

## Decimal to binary conversion without using arithmetic operators

Find the binary equivalent of the given non-negative number n without using arithmetic operators. Examples: Input : n = 10 Output : 1010 Input :… Read More »

## Program to check if three points are collinear

Given three points, check whether they lie on a straight (collinear) or not Examples: Input : (1, 1), (1, 4), (1, 5) Output : Yes… Read More »

## Difference between two given times

Given two times in string “HH:MM” format. Here ‘H’ shows hours and ‘M’ shows minutes. You have to find the difference in same string format… Read More »

## Find coordinates of a prime number in a Prime Spiral

Introduction The Ulam spiral is a graphical depiction of the set of prime numbers, devised by mathematician Stanislaw Ulam. It is constructed by writing the… Read More »

## Neon Number

A neon number is a number where the sum of digits of square of the number is equal to the number. The task is to… Read More »

## Check whether a given point lies inside a rectangle or not

Given four points of a rectangle, and one more point P. Write a function to check whether P lies within the given rectangle or not.… Read More »

## Number of rectangles in N*M grid

We are given a N*M grid, print the number of rectangles in it. Examples: Input : N = 2, M = 2 Output : 9… Read More »

## Sum of array elements that is first continuously increasing then decreasing

Given an array where elements are first continuously increasing and after that its continuously decreasing unit first number is reached again. We want to add… Read More »

## Balance pans using given weights that are powers of a number

Given a simple weighting scale with two pans, we are given a weight T and some other weights which are the powers of a specific… Read More »

## Erdos Renyl Model (for generating Random Graphs)

In graph theory, the Erdos–Rényi model is either of two closely related models for generating random graphs. There are two closely related variants of the… Read More »

## 1 to n bit numbers with no consecutive 1s in binary representation

Given a number n, our task is to find all 1 to n bit numbers with no consecutive 1s in their binary representation. Examples:- Input… Read More »