Find subarray with given sum (Non-negative Numbers)

Given a non-negative subarray of size n, we have to find the index of subarrays such that their sum is equal to the given sum k. Note: If there may be more than one subarrays then print first such subarrays...

Minimum number of swaps required to sort a given array

Problem Statement: Given an array of n distinct elements, we have to find the minimum number of swaps required to sort the given array. Example - Input array - {2, 4, 5, 3, 1, 6} Output - 4 Explanation - Swap index 0...

Maximize the number of cut segments of length x, y and z

We are given a rod of length L, our task is to cut the rod into segments of x, y & z such that the total number of segments formed are maximized. Note - The cut segments should be...

Subscribe to our weekly newsletter

Join our community of 1000+ developers and stay updated with the fast moving world of computer science

We promsie, we won't spam
Even we hate spam as much as you hate them