Skip to content

first commit#1544

Open
sudheerkreddy wants to merge 1 commit into
super30admin:masterfrom
sudheerkreddy:master
Open

first commit#1544
sudheerkreddy wants to merge 1 commit into
super30admin:masterfrom
sudheerkreddy:master

Conversation

@sudheerkreddy

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Least Falling Path Sum (DeleteAndEarn.java)

The student appears to have submitted code for a different LeetCode problem (Delete and Earn #740) rather than the "Least Falling Path Sum" problem (LeetCode #931).

Key issues:

  1. Wrong problem: The solution solves "Delete and Earn" not "Least Falling Path Sum"
  2. No matrix traversal: The falling path problem requires checking (row+1, col), (row+1, col-1), and (row+1, col+1) - this is completely missing
  3. Incorrect approach: The House Robber DP pattern used here is not applicable to this problem

To solve the Falling Path Sum problem correctly, the student should:

  • Use dynamic programming starting from the last row (bottom-up approach is most efficient)
  • For each cell, compute the minimum sum to reach that cell from any starting position in row 0
  • The recurrence relation should be: dp[i][j] = matrix[i][j] + min(dp[i+1][j], dp[i+1][j-1], dp[i+1][j+1]) with boundary checks

The code quality itself is good (clear variable names, proper initialization), but it's solving the wrong problem entirely.

VERDICT: NEEDS_IMPROVEMENT


Delete and Earn (HouseRobber.java)

** The student has implemented a correct solution for the House Robber problem but has not addressed the Delete and Earn problem. The key insight for Delete and Earn is that you need to first transform the input by creating a frequency array where each index represents a value and the array stores the sum of all occurrences of that value. Then apply the House Robber DP logic on this transformed array. The student should:

  1. First find the maximum value in nums to determine the size of the frequency array
  2. Build the frequency array by summing all occurrences
  3. Apply the House Robber DP on this frequency array

**

VERDICT: NEEDS_IMPROVEMENT

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