Skip to content

Commit

Permalink
Update pythonCreate: 374-Guess-Number-Higher-or-Lower.py
Browse files Browse the repository at this point in the history
I have changed the spacing .
  • Loading branch information
grievous-mischievous7 authored Nov 15, 2022
1 parent 38f7021 commit 432381e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pythonCreate: 374-Guess-Number-Higher-or-Lower.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class Solution:
def guessNumber(self, n: int) -> int:
# return a num btw 1,..,n
low=1
high=n
low = 1
high = n
while True:
mid=low+(high-low)//2
myGuess=guess(mid)
if myGuess==1:
low=mid+1
elif myGuess==-1:
high=mid-1
mid = low + (high - low)//2
myGuess = guess(mid)
if myGuess == 1:
low = mid + 1
elif myGuess == -1:
high = mid - 1
else:
return mid

0 comments on commit 432381e

Please sign in to comment.