Skip to content

Commit 0ac14b2

Browse files
committed
style: shorten docstring comment to fix E501
1 parent 0dd2b8d commit 0ac14b2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

backtracking/word_search_path.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,19 @@ def get_word_path(
6565
>>> # 1. Find "CATS" starting at (0,0). Initial key is 0.
6666
>>> get_word_path(board, "CATS", 0, 0, 0, {0}, [])
6767
[(0, 0), (0, 1), (0, 2), (1, 2)]
68-
69-
>>> # 2. Find "BC" starting at (2,1).
68+
69+
>>> # 2. Find "BC" starting at (2,1).
7070
>>> # Key for (2,1) in 3x3 is: (3 * 3 * 2) + 1 = 19
7171
>>> get_word_path(board, "BC", 2, 1, 0, {19}, [])
7272
[(2, 1), (2, 2)]
73-
74-
>>> # 3. Partial search: current_path already has (0,0), looking for "ATS" starting at (0,1)
75-
>>> # Key for (0,1) is 1. Visited includes the 'C' at key 0.
73+
74+
>>> # 3: Partial search with existing path
7675
>>> get_word_path(board, "ATS", 0, 1, 0, {0, 1}, [(0, 0)])
7776
[(0, 0), (0, 1), (0, 2), (1, 2)]
77+
78+
>>> # 4. Failure case: First letter doesn't match current cell
79+
>>> get_word_path(board, "DOG", 0, 0, 0, {0}, []) is None
80+
True
7881
"""
7982

8083
if board[row][column] != word[word_index]:

0 commit comments

Comments
 (0)