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

Commit16d74b3

Browse files
authored
Create 0287-Find-The-Duplicate-Number.rb
1 parent939af48 commit16d74b3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# @param {Integer[]} nums
2+
# @return {Integer}
3+
deffind_duplicate(nums)
4+
a=0
5+
b=0
6+
7+
loopdo
8+
a=nums[a]
9+
b=nums[b]
10+
b=nums[b]
11+
12+
breakifa ==b
13+
end
14+
15+
a=0
16+
loopdo
17+
a=nums[a]
18+
b=nums[b]
19+
breakifa ==b
20+
end
21+
22+
a
23+
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp