# Category Archives: Algorithms

## Count of all possible ways to reach a target by a Knight

Given two integers N, M denoting N×M chessboard, the task is to count the number of ways a knight can reach (N, M) starting from… Read More »

## Add two numbers represented by Stacks

Given two numbers N1 and N2 represented by two stacks, such that their most significant digits are present at the bottom of the stack, the… Read More »

## Lexicographic smallest permutation of a String containing the second String as a Substring

Given two strings str1 and str2, the task is to find the lexicographic smallest permutation of str1 that contains str2 as a substring.Note: Assume that… Read More »

## Count of substrings of a Binary string containing only 1s

Given a binary string of length N, we need to find out how many sub-strings of this string contains only 1s. Examples:  Input: S =… Read More »

## Product of proper divisors of a number for Q queries

Given an integer N, the task is to find the product of proper divisors of the number modulo 109 + 7 for Q queries. Examples:… Read More »

## Highest power of 2 that divides the LCM of first N Natural numbers.

Given a number N, the task is to find the largest power of 2 that divides LCM of first N Natural numbers. Examples: Input: N… Read More »

## Check if number can be made prime by deleting a single digit

Given an integer N, the task is to check if it is possible to make N prime by deleting any single digit from N. Examples:… Read More »

## Check if a number has an odd count of odd divisors and even count of even divisors

Given an integer N, the task is to check if N has an odd number of odd divisors and even number of even divisors. Examples:… Read More »

## Count of distinct permutations of every possible length of given string

Given a string S, the task is to count the distinct permutations of every possible length of the given string. Note: Repetition of characters is… Read More »

## Find the area of rhombus from given Angle and Side length

Given two integers A and X, denoting the length of a side of a rhombus and an angle respectively, the task is to find the… Read More »

## Restore original String from given Encrypted String by the given operations

Given a string str and a positive integer N, the task is to reverse N characters and skip N characters until the end of the… Read More »

The Google online challenge 2020 for summer internships 2021 was held on August 16. It was a 60-minute online test having 2 questions to code.… Read More »