Rachit Gupta·Dec 28, 2016Leetcode: Square Root (Sqrt)Square root of n will lie in the range [1, n]. So we need to search for x in a sorted array such that x*x equals given number. As you can…
Rachit Gupta·Dec 28, 2016Leetcode: Remove Duplicates from Sorted ListIterate through the list and delete next node if its value matches the current node
Rachit Gupta·Dec 28, 2016Leetcode: Minimum Path SumThis one can be easily visualized as a dynamic programming problem as the path ending at grid point can either come from the point above it…A response icon2A response icon2
Rachit Gupta·Dec 28, 2016Leetcode: Unique PathsThis is just like the finonacci series calculation using dynamic programming. Fibonacci series is in one dimension here we have a two…
Rachit Gupta·Dec 28, 2016Leetcode: Length of last wordOnly trick here is to select the most efficient way of finding the last word
Rachit Gupta·Dec 28, 2016Hackerrank : The Maximum SubarrayGiven an array of integers, findA response icon1A response icon1
Rachit Gupta·Dec 27, 2016Leetcode: Guess number higher or lower doneThis is a simple application of binary search. We are given the upper bound as input and lower bound is 1. Think of it as a sorted list…
Rachit Gupta·Dec 27, 2016Leetcode: Ugly NumberThe problem is to list numbers divisible by 2, 3 and 5 in order. Brute force approach is to just check each number for divisibility by 2, 3…