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

feat(uniquepaths): add solution for unique paths problem #716

Merged
merged 5 commits into from
May 11, 2024

Conversation

rares985
Copy link
Contributor

Provides a solution to the "Unique Paths" problem. That is, in how many ways can you traverse an m x n matrix from (0, 0) to (m-1, n-1)

@sozelfist
Copy link
Contributor

This looks like a good implementation of the dynamic programming solution for the "Unique Paths" problem. One minor adjustment I would suggest is to remove the +1 when creating the grid. Since you're using zero-based indexing, allocating m+1 and n+1 for the grid creates unnecessary space. Simply use m and n instead. This adjustment makes the code a bit more concise. Other than that, the logic and implementation seem correct!

dynamic/uniquepaths.go Outdated Show resolved Hide resolved
dynamic/uniquepaths.go Outdated Show resolved Hide resolved
dynamic/uniquepaths.go Outdated Show resolved Hide resolved
@rares985
Copy link
Contributor Author

@yanglbme, @raklaptudirm Could you please review?

@rares985
Copy link
Contributor Author

rares985 commented May 9, 2024

@raklaptudirm, could you please have a look over this PR? It's been sitting here for 3 weeks.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.43%. Comparing base (2354582) to head (0d756b0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #716      +/-   ##
==========================================
+ Coverage   87.36%   87.43%   +0.07%     
==========================================
  Files         201      202       +1     
  Lines        5333     5347      +14     
==========================================
+ Hits         4659     4675      +16     
+ Misses        534      533       -1     
+ Partials      140      139       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@raklaptudirm raklaptudirm merged commit 2f8c738 into TheAlgorithms:master May 11, 2024
5 checks passed
@rares985 rares985 deleted the unique-paths branch May 13, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants