Skip to content

Done#860

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

Done#860
infinitysugam wants to merge 1 commit intosuper30admin:masterfrom
infinitysugam:master

Conversation

@infinitysugam
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

  1. Valid_Soduko.py:

    • Correctness: The solution appears to correctly validate a Sudoku board by checking for duplicates in rows, columns, and 3x3 sub-boxes. However, it might miss some edge cases where the board is not completely filled (which is allowed in Sudoku validation).
    • Time Complexity: The stated O(m*n) is correct, where m and n are the dimensions of the board (9x9 in Sudoku).
    • Space Complexity: The stated O(m*n) is correct, as the solution stores all elements in a list.
    • Code Quality: The code is concise but could benefit from better variable naming (e.g., 'res' could be 'seen_elements') and comments explaining the approach.
    • Efficiency: The solution is efficient for the given problem, but using sets for each row, column, and sub-box could potentially improve both time and space complexity.
  2. largest_value_in_each_tree_row.py:

    • Correctness: The solution correctly finds the largest value in each level of a binary tree using BFS. It handles empty trees appropriately.
    • Time Complexity: The stated O(n) is correct, where n is the number of nodes in the tree.
    • Space Complexity: The stated O(n) is correct, as the queue can hold up to n nodes in the worst case.
    • Code Quality: The code is well-structured but could benefit from more descriptive variable names (e.g., 'element' could be 'node'). The indentation is inconsistent in some places.
    • Efficiency: The solution is efficient, but the check for 'i == 0' could be moved outside the loop to improve readability and slightly optimize performance.

Overall, both solutions are correct and efficient, but could benefit from improved code quality and readability.

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