Skip to content

Commit 652b6f8

Browse files
authored
Update kth-smallest-instructions.py
1 parent d185487 commit 652b6f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/kth-smallest-instructions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def nCr(n, r): # Time: O(n), Space: O(1)
2323
result = []
2424
while r+c:
2525
count = nCr(r+(c-1), r) # the number of HX..X combinations
26-
if k <= count: # kth instruction is one of HX..X combinations, so go right
26+
if k <= count: # the kth instruction is one of HX..X combinations, so go right
2727
c -= 1
2828
result.append('H')
29-
else: # kth instruction is one of VX..X combinations, so go down
29+
else: # the kth instruction is one of VX..X combinations, so go down
3030
r -= 1
31-
k -= count # kth of XX..X combinations is the (k-count)th of X..X combinations
31+
k -= count # the kth one of XX..X combinations is the (k-count)th one of X..X combinations
3232
result.append('V')
3333
return "".join(result)

0 commit comments

Comments
 (0)