Home
Gaurav's GitHub Page
Cancel

Minimum number of jumps (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of N integers arr[] where each element represents the maximum length of the jump that can be made forward from that element. This means if arr[i] = x, then we ca...

Kadane's Algorithm (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array Arr[] of N integers. Find the contiguous sub-array(containing at least one number) which has the maximum sum and return its sum. geeksforgeeks SOLUTION class ...

Find Indexes of a subarray with given sum (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an unsorted array A of size N that contains only non negative integers, find a continuous sub-array that adds to a given number S and return the left and right index(1-ba...

Minimize the sum of product (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You are given two arrays, A and B, of equal size N. The task is to find the minimum value of A[0] * B[0] + A[1] * B[1] + .... + A[N-1] * B[N-1], where shuffling of elements of ...

Convert array into Zig-Zag fashion (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array arr of distinct elements of size N, the task is to rearrange the elements of the array in a zig-zag fashion so that the converted array should be in the below fo...

Find all pairs with a given sum (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two unsorted arrays A of size N and B of size M of distinct elements, the task is to find all pairs from both arrays whose sum is equal to X. Note: All pairs should be p...

Longest Common Prefix in an Array (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of N strings, find the longest common prefix among all strings present in the array. Return “-1” if there is no common prefix. geeksforgeeks SOLUTION class So...

Equilibrium Point (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array A of n non negative numbers. The task is to find the first equilibrium point in an array. Equilibrium point in an array is an index (or position) such that the s...

Leaders in an array (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array A of positive integers. Your task is to find the leaders in the array. An element of array is a leader if it is greater than or equal to all the elements to its ...

Missing number in array (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of size N-1 such that it only contains distinct integers in the range of 1 to N. Find the missing element. geeksforgeeks SOLUTION class Solution { int mi...