Given an array arr[] of size N, the task is to find the maximum sum non-empty subsequence present in the given array. Examples: Input: arr[]… Read More

# Category Archives: Searching

Given an array arr[] of length N consisting of positive integers, the task is to find the longest increasing subsequence that can be formed by… Read More

Given an array arr[] of size N, the task is to find the sum of the floor value of (arr[i] / arr[j]) for all pairs… Read More

Given two integers N and K, the task is to find the count of numbers up to N having K-th bit set. Examples: Input: N… Read More

Given an integer N, the task is to count the triplets (a, b, c) from the first N natural numbers such that a * b… Read More

Given a valid parenthesis string str consisting of lowercase alphabets, opening, and closing brackets, the task is to find the string by removing the outermost… Read More

Given a positive integer N, the task is to find the count of all the numbers M such that when the number N is divided… Read More

Given an array arr[] of size N, the task is to find the smallest indexed array element whose sign needs to be flipped such that… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to count the number of array elements having exactly K… Read More

Given a Binary Tree consisting of N nodes, the task to find the maximum average of values of nodes of any subtree. Examples: Input: … Read More

Given an array arr[] of size N, the task is to find all the triplets (i, j, k) such that replacing the elements of the… Read More

Queries to find the length of the longest prefix from given array having all elements divisible by K

Given an array arr[] consisting of N elements and an arrayQ[], the task for each query is to find the length of the longest prefix… Read More

Given a string S of length N, the task is to check if a string can be split into two substrings, say A and B… Read More

Given two strings S and T of length N and M respectively, the task is to check if the string S can be converted to… Read More