[minFallingPathSum + deleteAndEarn]#1524
Conversation
|
Your solution for One minor improvement: In the inner loop, you are calculating int minAbove = prev[j];
if (j > 0) minAbove = Math.min(minAbove, prev[j-1]);
if (j < n-1) minAbove = Math.min(minAbove, prev[j+1]);which is clear and efficient. Overall, great job on the main problem! Just be cautious to not include extraneous code. |
|
Your solution for the "Least Falling Path Sum" problem is excellent. You have implemented an efficient dynamic programming approach with O(n^2) time and O(n) space, which is optimal. The code is clean and well-commented. However, note that the problem only requires one solution, so including an unrelated method (like deleteAndEarn) might be confusing for someone reading the code. It's better to separate solutions for different problems into different files or classes. Keep up the good work! |
No description provided.