Skip to content

Completed s30 BFS-2-1 - #644

Open
prenastro wants to merge 1 commit into
super30admin:mainfrom
prenastro:main
Open

Completed s30 BFS-2-1#644
prenastro wants to merge 1 commit into
super30admin:mainfrom
prenastro:main

Conversation

@prenastro

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Rotting Oranges (empimportance.py)

Strengths:

  • Clean, readable code with good variable naming
  • Proper use of BFS with deque
  • HashMap for O(1) employee lookup
  • Includes time/space complexity analysis

Critical Issue:

  • This solution solves the wrong problem. The "Employee Importance" problem requires finding the total importance of an employee and their subordinates. The "Rotting Oranges" problem requires simulating the spread of rot through a grid over time.

For the Rotting Oranges problem, you would need:

  • A 2D grid traversal
  • Multi-source BFS starting from all rotten oranges simultaneously
  • Track time in minutes as you process each BFS level
  • Count fresh oranges and check if any remain at the end

Please resubmit a solution that addresses the Rotting Oranges problem specifically.

VERDICT: NEEDS_IMPROVEMENT


Employee Importance (rottingoranges.py)

  1. Wrong Problem: The submitted solution solves "Rotting Oranges" but the assignment was "Employee Importance". This is a fundamental issue that needs to be addressed.

  2. Strengths of the submitted code:

    • Clean, readable code structure
    • Good use of deque for BFS
    • Proper boundary checking
    • Handles edge cases appropriately
    • Well-commented with time/space complexity notes
  3. If this were the correct problem:

    • The solution would be correct and efficient
    • Could potentially use a set to avoid processing same cell twice (though grid modification works fine)
  4. For the correct problem (Employee Importance):

    • Would need to build a hash map from employee list
    • Use BFS/DFS to traverse subordinates
    • Sum importance values recursively

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