## N-bonacci Numbers

You are given two Integers N and M, and print all the terms of the series upto M-terms of the N-bonacci Numbers. For example, when… Read More »

## Subarray with no pair sum divisible by K

Given an array of N non-negative integers, task is to find the maximum size of a subarray such that the pairwise sum of the elements… Read More »

## Number of subarrays having sum less than K

Given an array of numbers and a number k, find the number of subarrays having sum less than k. We may assume that there is… Read More »

## Number of subarrays with given product

Given an array of positive numbers and a number k, find the number of subarrays having product exactly equal to k. We may assume that… Read More »

## Minimum Swaps required to group all 1’s together

Given an array of 0’s and 1’s, we need to write a program to find the minimum number of swaps required to group all 1’s… Read More »

## Maximum segment value after putting k breakpoints in a number

Given a large number as string s and an integer k which denotes the number of breakpoints we must put in the number k <=… Read More »

## Find the longest sub-array having exactly k odd numbers

Given an array of size n. The problem is to find the longest sub-array having exactly k odd numbers. Examples: Input : arr[] = {2,… Read More »

## Construct sum-array with sum of elements in given range

You are given an array of n-elements and an odd-integer m. You have to construct a new sum_array from given array such that sum_array[i] =… Read More »

## Find mean of subarray means in a given array

You are given an array of n-elements you have to find the mean of the array as mean of all consecutive m-elements of array for… Read More »

## Number of subarrays with maximum values in given range

Given an array of N elements and L and R, print the number of sub-arrays such that the value of the maximum array element in… Read More »

## Differences between number of increasing subarrays and decreasing subarrays in k sized windows

Given an array of integers and k, find the difference between the number of the strictly increasing number of subarrays (of size more than one)… Read More »

## Maximum Unique Element in every subarray of size K

Given an array and an integer K. We need to find the maximum of every segment of length K which has no duplicates in that… Read More »

## Longest subarray not having more than K distinct elements

Given N elements and a number K, find the longest subarray which has not more than K distinct elements.(It can have less than K) Examples:… Read More »

## Smallest subarray with k distinct numbers

We are given an array a consisting of n integers and an integer k. We need to find the minimum range in array [l, r]… Read More »

## Distance of closest zero to every element

Given an array of n integers, for each element, print the distance to the closest zero. Array has a minimum of 1 zero in it.… Read More »