Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0120 - Triangle #34

Open
vJechsmayr opened this issue Sep 23, 2020 · 1 comment
Open

0120 - Triangle #34

vJechsmayr opened this issue Sep 23, 2020 · 1 comment

Comments

@vJechsmayr
Copy link
Owner

@vJechsmayr vJechsmayr commented Sep 23, 2020

Description of the Problem

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.

For example, given the following triangle

[
     [2],
    [3,4],
   [6,5,7],
  [4,1,8,3]
]

The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11).

Note:
Bonus point if you are able to do this using only O(n) extra space, where n is the total number of rows in the triangle.

Code

class Solution:
    def minimumTotal(self, triangle: List[List[int]]) -> int:

Link To The LeetCode Problem

LeetCode

@RSMuthu
Copy link

@RSMuthu RSMuthu commented Sep 24, 2020

Hi,
I shall work on this.

RSMuthu added a commit to RSMuthu/PythonAlgorithms that referenced this issue Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.