Home
Gaurav's GitHub Page
Cancel

Min Sum Path in Matrix

Problem Description Given a M x N grid A of integers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Return the minimum sum of the path. NOTE: You...

Min Triangle Sum

Problem Description Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index ...

N digit numbers with digit sum S

Problem Description Find out the number of N digit numbers, whose digits on being added equals to a given number S. Note that a valid number starts from digits 1-9 except the number 0 itself. i.e....

Edit Distance

Problem Description Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations permitted on a word: ...

Longest Common Subsequence

Problem Description Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence of a string is a new strin...

Dungeon Game

Problem Description The demons had captured the princess and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of m x n rooms laid out in a 2D grid. Our valiant knight w...

Longest Increasing Subsequence

Problem Description Given an integer array nums, return the length of the longest strictly increasing subsequence leetcode Solution class Solution { public int lengthOfLIS(int[] nums) { ...

Maximum sum such that no two elements are adjacent

Problem Description Given an array arr[] of positive numbers, The task is to find the maximum sum of a subsequence such that no 2 numbers in the sequence should be adjacent in the array. geeksfor...

Perfect Squares

Problem Description Given an integer n, return the least number of perfect square numbers that sum to n. A perfect square is an integer that is the square of an integer; in other words, it is the...

Unique Paths II

Problem Description You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e...