Home
Gaurav's GitHub Page
Cancel

Uncommon characters (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two strings A and B consisting of lowercase english characters. Find the characters that are not common in the two strings. Return the string in sorted order. geeksforg...

Search in a row-column sorted Matrix (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a matrix of size n x m, where every row and column is sorted in increasing order, and a number x. Find whether element x is present in the matrix or not. geeksforgeeks ...

Sort an array according to the other (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two integer arrays A1[ ] and A2[ ] of size N and M respectively. Sort the first array A1[ ] such that all the relative positions of the elements in the first array are th...

Allocate minimum number of pages (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You have N books, each with A[i] number of pages. M students need to be allocated contiguous books, with each student getting at least one book. Out of all the permutations, t...

Minimum Swaps to Sort (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of n distinct elements. Find the minimum number of swaps required to sort the array in strictly increasing order. geeksforgeeks SOLUTION Good Explanation We ...

Rearrange Array Alternately (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a sorted array of positive integers. Your task is to rearrange the array elements alternatively i.e first element should be max value, second should be min value, third s...

Zero Sum Subarrays (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You are given an array arr[] of size n. Find the total count of sub-arrays having their sum equal to 0. geeksforgeeks SOLUTION class Solution{ public static long findSu...

Largest subarray with 0 sum (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array having both positive and negative integers. The task is to compute the length of the largest subarray with sum 0. geeksforgeeks SOLUTION We will keep calculat...

Maximum of all subarrays of size k (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array arr[] of size N and an integer K. Find the maximum for each and every contiguous subarray of size K. geeksforgeeks SOLUTION APPROACH 1 - USING MAX HEAP (TLE) ...

Inorder Successor in BST

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...