Home
Gaurav's GitHub Page
Cancel

Reverse Words (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a String S, reverse the string without reversing its individual words. Words are separated by dots. geeksforgeeks SOLUTION APPROACH 1 (TWO POINTERS) class Solution { ...

Parenthesis Checker (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an expression string x. Examine whether the pairs and the orders of {,},(,),[,] are correct in exp. For example, the function should return ‘true’ for exp = [()]{}{[()()]...

Implement strstr (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Your task is to implement the function strstr. The function takes two strings as arguments (s,x) and locates the occurrence of the string x in the string s. The function return...

Solve the Sudoku (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an incomplete Sudoku configuration in terms of a 9 x 9 2-D square matrix (grid[][]), the task is to find a solved Sudoku. For simplicity, you may assume that there will b...

Kth element in Matrix (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a N x N matrix, where every row and column is sorted in non-decreasing order. Find the kth smallest element in the matrix. geeksforgeeks SOLUTION Good Explanation - Ar...

Find whether path exist (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a grid of size n*n filled with 0, 1, 2, 3. Check whether there is a path possible from the source to destination. You can traverse up, down, right and left. The descripti...

Maximum path sum in matrix (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a n x n matrix of positive integers. There are only three possible moves from a cell mat[r][c]. mat[r+1] [c] mat[r+1] [c-1] mat [r+1] [c+1] Starting from any co...

Shortest Source to Destination Path (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a 2D binary matrix A(0-based index) of dimensions NxM. Find the minimum number of steps required to reach from (0,0) to (X, Y). Note: You can only move left, right, up an...

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