Posts
Gaurav's GitHub Page
Cancel

Minimum Number of Keypresses

Problem Description You have a keypad with 9 buttons, numbered from 1 to 9, each mapped to lowercase English letters. You can choose which characters each button is matched to as long as: All ...

Minimum Adjacent Swaps to Make a Valid Array

Problem Description You are given a 0-indexed integer array nums. Swaps of adjacent elements are able to be performed on nums. A valid array meets the following conditions: The largest eleme...

Next Greater Node In Linked List

Problem Description You are given the head of a linked list with n nodes. For each node in the list, find the value of the next greater node. That is, for each node, find the value of the first n...

Minimum Number of Food Buckets to Feed the Hamsters

Problem Description You are given a 0-indexed string hamsters where hamsters[i] is either: ‘H’ indicating that there is a hamster at index i, or ’.’ indicating that index i is empty. You w...

Unique rows in boolean matrix (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a binary matrix your task is to find all unique rows of the given matrix in the order of their appearance in the matrix. geeksforgeeks SOLUTION For each row, we conver...

First non-repeating character in a stream (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an input stream A of n characters consisting only of lower case alphabets. While reading characters from the stream, you have to tell which character has appeared only on...

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