Home
Gaurav's GitHub Page
Cancel

Rotten Oranges (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a grid of dimension nxm where each cell in the grid can have values 0, 1 or 2 which has the following meaning: 0 : Empty cell 1 : Cells have fresh oranges 2 : Cel...

Smallest window in a string containing all the characters of another string (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two strings S and P. Find the smallest window in the string S consisting of all the characters(including duplicates) of the string P. Return “-1” in case there is no such...

Array Pair Sum Divisibility Problem (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of integers nums and a number k, write a function that returns true if given array can be divided into pairs such that sum of every pair is divisible by k. geek...

Longest consecutive subsequence (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of non-negative integers. Find the length of the longest sub-sequence such that elements in the subsequence are consecutive integers, the consecutive numbers can...

Convert a sentence into its equivalent mobile numeric keypad sequence (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a sentence in the form of a string in uppercase, convert it into its equivalent mobile numeric keypad sequence. Please note there might be spaces in between the words in ...

Find first repeated character (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a string S. The task is to find the first repeated character in it. We need to find the character that occurs more than once and whose index of second occurrence is small...

Minimum indexed character (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a string str and another string patt. Find the minimum index of the character in str that is also present in patt. geeksforgeeks SOLUTION class Solution { //Functi...

Count distinct elements in every window (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array of integers and a number K. Find the count of distinct elements in every window of size K in the array. geeksforgeeks SOLUTION class Solution { ArrayList...

Remove Duplicates (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a string str without spaces, the task is to remove all duplicate characters from it, keeping only the first occurrence. Note: The original order of characters must be ke...

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. Note :- Return the string in sorted order. g...