Smallest subarray such that all elements are greater than K

Given an array of N integers and a number K, the task is to find the length of the smallest subarray in which all the… Read More »

Sum of all the multiples of 3 and 7 below N

Given a number N, the task is to find the sum of all the multiples of 3 and 7 below N. Note: A number must… Read More »

Minimum number of elements to be removed so that pairwise consecutive elements are same

Given a string str. The task is to count the minimum number of elements to be removed so that pairwise consecutive elements are same Examples:… Read More »

Count the number of vowels occurring in all the substrings of given string

Given a string of length N of lowercase characters containing 0 or more vowels, the task is to find the count of vowels occurred in… Read More »

Minimize the value of N by applying the given operations

Given an integer N, below operations can be performed any number of times on N: Multiply N by any positive integer X i.e. N =… Read More »

Minimum number of elements to be replaced to make the given array a Fibonacci Sequence

Given an array arr containing N integer elements, the task is to count the minimum number of elements that need to be changed such that… Read More »

Find the sum of first N odd Fibonacci numbers

Given a number, N. find the sum of first N odd Fibonacci numbers. Note: The answer can be very large so print the answer modulo… Read More »

Sum and product of k smallest and k largest prime numbers in the array

Given an integer k and an array of integers arr, the task is to find the sum and product of k smallest and k largest… Read More »

Find consecutive 1s of length >= n in binary representation of a number

Given two integers x and n, the task is to search for the first consecutive stream of 1s (in the x’s 32-bit binary representation) which… Read More »

Check whether all the rotations of a given number is greater than or equal to the given number or not

Given an integer x, the task is to find if every k-cycle shift on the element produces a number greater than or equal to the… Read More »

Sum of every K’th prime number in an array

Given an integer k and an array of integers arr (less than 10^6), the task is to find the sum of every k’th prime number… Read More »

Find maximum distance between any city and station

Given the number of cities n numbered from 0 to n-1 and the cities in which stations are located, the task is to find the… Read More »

Count subarrays consisting of only 0’s and only 1’s in a binary array

Given a binary array consisting of only zeroes and ones. The task is to find: The number of subarrays which has only 1 in it.… Read More »

Find the sum of all multiples of 2 and 5 below N

Given a number N. The task is to find the sum of all multiples of 2 and 5 below N ( N may be up… Read More »

Smallest prime divisor of a number

Given a number N, find the smallest prime divisor of N. Examples: Input: 25 Output: 5 Input: 31 Output: 31 Recommended: Please try your approach… Read More »