Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit432381e

Browse files
Update pythonCreate: 374-Guess-Number-Higher-or-Lower.py
I have changed the spacing .
1 parent38f7021 commit432381e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
classSolution:
22
defguessNumber(self,n:int)->int:
33
# return a num btw 1,..,n
4-
low=1
5-
high=n
4+
low=1
5+
high=n
66
whileTrue:
7-
mid=low+(high-low)//2
8-
myGuess=guess(mid)
9-
ifmyGuess==1:
10-
low=mid+1
11-
elifmyGuess==-1:
12-
high=mid-1
7+
mid=low+(high-low)//2
8+
myGuess=guess(mid)
9+
ifmyGuess==1:
10+
low=mid+1
11+
elifmyGuess==-1:
12+
high=mid-1
1313
else:
1414
returnmid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp