# Category Archives: Algorithms

## Longest Increasing Subsequence having sum value atmost K

Given an integer array arr[] of size N and an integer K. The task is to find length of longest subsequence whose sum is less… Read More »

## XOR of a subarray (range of elements) | Set 2

Given an array integer arr[] of size N and Q queries. Each query is of the form (L, R), where L and R are indices… Read More »

## Find least non-overlapping number from a given set of intervals

Given an array interval of pairs of integers representing the starting and ending points of the interval of size N. The task is to find… Read More »

## String Range Queries to count number of distinct characters with updates

Given a string S of length N, and Q queries of the following type: Type 1: 1 i X Update the i-th character of the… Read More »

## Check if given permutation of 1 to N can be counted in clockwise or anticlockwise direction

Given an integer array arr of size N which contains distinct elements from 1 to N. The task is to check if a position in… Read More »

## Maximize the numbers of splits in an Array having sum divisible by 3

Given an integer array arr of size N. The task is to find the maximum number of splits such that each split has sum divisible… Read More »

## Maximum sum subarray of size range [L, R]

Given an integer array arr[] of size N and two integer L and R. The task is to find the maximum sum subarray of size… Read More »

## First subarray with negative sum from the given Array

Given an array arr[] consisting of N integers, the task is to find the start and end indices of the first subarray with a Negative… Read More »

## Find the angle of Rotational Symmetry of an N-sided regular polygon

Given an integer N which is the number of sides of a regular polygon. The task is to find the smallest angle of rotation such… Read More »

## Maximise number of cuts in a rod if it can be cut only in given 3 sizes

Given a rod of length N meters, and the rod can be cut in only 3 sizes A, B and C. The task is to… Read More »

## Largest odd divisor Game to check which player wins

Two players are playing a game starting with a number n. In each turn, a player can make any one of the subsequent moves:   Divide… Read More »

## Generate an alternate increasing and decreasing Array

Given a string str of size N containing two types of character only that are “I” or “D”. The task is to generate an array… Read More »

## Check if an URL is valid or not using Regular Expression

Given a URL as a character string str of size N.The task is to check if the given URL is valid or not. Examples :… Read More »

## Print the nodes of Binary Tree having a grandchild

Given a Binary Tree, the task is to print the nodes that have grandchildren. Examples: Input: Output: 20 8 Explanation: 20 and 8 are the… Read More »

## Check if the Binary Tree contains a balanced BST of size K

Given a Binary Tree and a positive integer K. The task is to check whether the Balanced BST of size K exist in a given… Read More »