Array-2#1870
Conversation
Disappeared Numbers (Find Disappeared Number.py)Your solution is excellent! It correctly solves the problem with optimal time and space complexity. Here are some points to consider: Strengths:
Areas for improvement:
For example: # Mark each number that appears by negating the value at its corresponding index
for i in range(n):
index = abs(nums[i]) - 1
if nums[index] > 0:
nums[index] *= -1
# Collect indices where the value is positive (which means the number was not found)
result = []
for i in range(n):
if nums[i] > 0:
result.append(i+1)
# Optional: restore the original value
# nums[i] = abs(nums[i])Overall, great job! VERDICT: PASS max and min (GameOfLife.py)Dear student, It appears you have submitted your solution to the wrong problem. The reference solution provided is for finding the minimum and maximum values in an array, but your code is for Conway's Game of Life. Please make sure you're working on the correct problem. Regarding your Game of Life implementation:
For the Game of Life problem, a better approach would be:
VERDICT: NEEDS_IMPROVEMENT Life Game (Problem2.py)It seems there has been a misunderstanding. The problem you were asked to solve is Conway's Game of Life, which involves updating a 2D grid based on the number of live neighbors each cell has. However, your solution is for a completely different problem (finding the minimum and maximum in a 1D array). Please review the problem statement again. You need to write a function that takes a 2D list
I recommend:
For example, in Python, you might:
VERDICT: NEEDS_IMPROVEMENT |
No description provided.