Home
Gaurav's GitHub Page
Cancel

Longest Distinct characters in string (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a string S, find the length of the longest substring with all distinct characters. geeksforgeeks SOLUTION This can be solved using sliding window. Maintain a HashSet t...

Roman Number to Integer (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a string in roman no format (s) your task is to convert it to an integer . Various symbols and their values are given below. I 1 V 5 X 10 L 50 C 100 D 500 M 1000 geeks...

String Rotated by 2 Places (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two strings a and b. The task is to find if the string ‘b’ can be obtained by rotating (in any direction) string ‘a’ by exactly 2 places. geeksforgeeks SOLUTION class ...

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