Skip to content

DP2 2 PROBLEMS COMPLETED#1785

Open
BharathVuppala96 wants to merge 2 commits intosuper30admin:masterfrom
BharathVuppala96:master
Open

DP2 2 PROBLEMS COMPLETED#1785
BharathVuppala96 wants to merge 2 commits intosuper30admin:masterfrom
BharathVuppala96:master

Conversation

@BharathVuppala96
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solution for "Paint House" is excellent. It efficiently solves the problem with optimal time and space complexity. Here are some points to consider for improvement:

  • Comments: Adding comments would make the code more understandable. For example, you could explain that you are starting from the second last house and updating the costs in reverse order.
  • Variable Names: The variable names are concise, but using more descriptive names (like num_houses instead of n) might enhance readability.
  • Input Modification: While modifying the input array in place is efficient, it's good to be aware that this changes the original input. In an interview, you might want to mention that or create a copy if necessary. However, for this problem, it is acceptable.

Overall, great job! Your solution is better than the reference solution in terms of time and space complexity.

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.

2 participants