Skip to content

Conversation

@ravithakur2k
Copy link

Added NQueens.py implementing the N-Queens problem using backtracking, and WordSearch.py solving the Word Search problem with DFS. Both solutions include time and space complexity comments and have been tested on LeetCode.

Added NQueens.py implementing the N-Queens problem using backtracking, and WordSearch.py solving the Word Search problem with DFS. Both solutions include time and space complexity comments and have been tested on LeetCode.
@super30admin
Copy link
Owner

Strengths:

  • The solutions are correct and efficient, with accurate time and space complexity analysis.
  • The code is well-organized and readable, with good use of helper functions.
  • Comments and variable names are clear and descriptive.

Areas for Improvement:

  • In NQueens.py, the isSafe function could be optimized further by checking only the necessary positions (upper rows, upper left, and upper right) without resetting i and j multiple times. This is a minor optimization but could improve clarity.
  • In WordSearch.py, the dfs function could be slightly optimized by returning early if the word is found, which it already does, but the logic could be made more explicit in comments.

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