Skip to content

Completed Array 2#1885

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

Completed Array 2#1885
RitikaC1 wants to merge 1 commit into
super30admin:masterfrom
RitikaC1:master

Conversation

@RitikaC1

@RitikaC1 RitikaC1 commented Jul 1, 2026

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Find All Numbers Disappeared in an Array (Problem1.py)

Strengths:

  • Excellent implementation of the in-place marking algorithm
  • Correctly handles edge cases (already negated values using abs())
  • Clean and readable code with good variable naming
  • Achieves optimal O(n) time complexity
  • Properly follows the constraint of O(1) extra space

Areas for Improvement:

  • Could add a brief comment explaining the algorithm's core idea for future maintainability
  • The solution assumes the input array can be modified, which is fine per the problem but worth noting

This is a strong, optimal solution that demonstrates good understanding of array manipulation techniques.

VERDICT: PASS


max and min (Problem2.py)

Strengths of the Game of Life solution (if that's what was intended):

  • Clean, well-structured code with good variable naming
  • Efficient use of in-place modification (O(1) space)
  • Good use of helper function for counting neighbors
  • Proper handling of boundary conditions
  • Clear comments explaining time and space complexity

Critical Issue:

  • The submitted solution solves a completely different problem than what was assigned. The reference solution is for finding min/max in an array, but the student submitted code for the Game of Life problem.

Recommendation:
If this was an error, please submit the correct solution for the "max and min" problem. If the assignment was actually for Game of Life, please clarify the requirements.

VERDICT: NEEDS_IMPROVEMENT


Game of Life

Strengths:

  1. Correctly implements the in-place algorithm using intermediate states (2 and 3)
  2. Properly counts neighbors including cells that will die (board[r][c]==2) to ensure simultaneous updates
  3. Clean, readable code with good variable naming
  4. Correct boundary checking for edge cells
  5. Efficient two-pass approach matching the optimal solution

Areas for Improvement:

  1. Consider caching len(board) and len(board[0]) in local variables before loops to avoid repeated function calls
  2. The code could benefit from a brief comment explaining the intermediate states (2 = dying, 3 = becoming alive)
  3. Minor: Could use more descriptive names like live_to_dead and dead_to_live constants instead of magic numbers 2 and 3

Overall, this is a solid implementation that demonstrates good understanding of the problem and the in-place update requirement.

VERDICT: PASS

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