Skip to content

Completed Arrays-2#1863

Open
nagasai67 wants to merge 1 commit intosuper30admin:masterfrom
nagasai67:master
Open

Completed Arrays-2#1863
nagasai67 wants to merge 1 commit intosuper30admin:masterfrom
nagasai67:master

Conversation

@nagasai67
Copy link

No description provided.

@super30admin
Copy link
Owner

Disappeared Numbers (findAll.py)

The student should be commended for implementing an efficient O(n) time and O(1) space solution. The code is clean and well-commented. One minor suggestion is to declare idx inside the loop to limit its scope, but it's not a big issue.

VERDICT: PASS


max and min (game.py)

It appears you may have submitted the wrong code for this problem. Please review the problem statement: you need to find the min and max in an array with less than 2*(N-2) comparisons. Your current solution is for a grid-based problem, which is unrelated. I recommend implementing an algorithm that efficiently finds min and max with minimal comparisons, such as the tournament method or the approach shown in the reference solution. Once you have the correct code, resubmit it for evaluation.

VERDICT: NEEDS_IMPROVEMENT


Life Game

Your solution is excellent. It correctly implements the in-place update with state encoding. Here are a few minor points for improvement:

  1. The dirs list is defined inside the method, which is fine. However, you could also define it as a class constant if you prefer, but it's not necessary.
  2. The getCount function is defined inside gameOfLife, which is acceptable in Python. However, you might consider passing board, m, and n as parameters to the helper function instead of relying on closure. This would make the helper function more explicit and potentially easier to test. But the current approach is acceptable.

Overall, your solution is correct, efficient, and follows good coding practices. Well done!

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.

3 participants