PROBLEM DESCRIPTION Given the root of a binary search tree and a node p in it, return the in-order successor of that node in the BST. If the given node has no in-order successor in the tree, retur...
Reverse words in a given string (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given a String S, reverse the string without reversing its individual words. Words are separated by dots. geeksforgeeks SOLUTION A simple way to solve this is by using split...
K-th element of two Arrays (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given two sorted arrays arr1 and arr2 of size N and M respectively and an element K. The task is to find the element that would be at the kth position of the final sorted array...
Length Unsorted Subarray
PROBLEM DESCRIPTION Given an unsorted array Arr of size N. Find the subarray Arr[s...e] such that sorting this subarray makes the whole array sorted. geeksforgeeks SOLUTION Good Explanation cl...
Kth smallest element (geeksforgeeks - SDE Sheet)
PROBLEM DESCRIPTION Given an array arr[] and an integer K where K is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array element...
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...