Arnab Chakraborty has Published 4293 Articles

Minimum Path Sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 06:07:35

775 Views

Suppose we have a m x n matrix filled with non-negative integers, find a path from top left corner to bottom right corner which minimizes the sum of all numbers along its path. Movements can only be either down or right at any point in time. So for example, if ... Read More

Unique Paths II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 06:06:20

256 Views

Suppose there is a robot is located at the top-left corner of a n x m grid (n rows and m columns). The robot can only move either down side or right side at any point in time. The robot wants to reach the bottom-right corner of the grid (marked ... Read More

Unique Paths in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 06:02:28

762 Views

Suppose there is a robot is located at the top-left corner of a n x m grid (n rows and m columns). The robot can only move either down side or right side at any point in time. The robot wants to reach the bottom-right corner of the grid (marked ... Read More

Rotate List in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 05:59:49

695 Views

Suppose we have a linked list. We have to rotate the list to the right k places. The value of k is not negative. So if the list is like [1, 23, 4, 5, NULL], and k = 2, then the output will be [4, 5, 1, 2, 3, NULL]Let ... Read More

Permutation Sequence in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 05:58:12

611 Views

Suppose the set is like [1, 2, 3, ..., n], contains a total of n! unique permutations. By listing and labeling all of the permutations in order, we get these sequence for n = 3: ["123", "132", "213", "231", "312", "321"] So if n and k are given, then return ... Read More

Spiral Matrix II in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 05:56:58

2K+ Views

Suppose we have a positive integer n, we have to generate a square matrix with n2 elements in spiral order. So if n = 5, then the matrix will be −12341213145111615610987Let us see the steps −set (row1, col1) := (0, 0) and (row2, col2) := (n, n), and create one ... Read More

Merge Intervals in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 05:55:55

1K+ Views

Suppose we have a collection of intervals, we have to merge all overlapping intervals. So if the intervals are like [[1, 3], [2, 6], [8, 10], [15, 18]], then the intervals after merging will be [[1, 6], [8, 10], [15, 18]]. This is because there were two intervals those are ... Read More

Jump Game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 05:54:49

3K+ Views

Suppose we have an array of non-negative integers; we are initially positioned at the first index of the array. Each element in the given array represents out maximum jump length at that position. We have to determine if we are able to reach the last index or not. So if ... Read More

Combination Sum II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 05:54:02

499 Views

Suppose we have a set of candidate numbers (all elements are unique) and a target number. We have to find all unique combinations in candidates where the candidate numbers sum to the given target. The same number will not be chosen from candidates more than once. So if the elements ... Read More

Combination Sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 04-May-2020 05:44:46

2K+ Views

Suppose we have a set of candidate numbers (all elements are unique) and a target number. We have to find all unique combinations in candidates where the candidate numbers sum to the given target. The same repeated number may be chosen from candidates unlimited number of times. So if the ... Read More

Advertisements