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

Commit 591f454

Browse files
Create 2485.py
1 parent 2d169ef commit 591f454

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎2401-2500/2485.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def pivotInteger(self, n: int) -> int:
3+
l = []
4+
for a in range(1,n+1):
5+
l.append(a)
6+
#print(l)
7+
for a in range(n,0,-1):
8+
if sum(l[a:])==sum(l[:a-1]):
9+
return a
10+
continue
11+
return 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /