FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
leetcode/removeduplicatesfromsortedarray.java at master · wpande/leetcode · GitHub
wpande
leetcode
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
leetcode
/
removeduplicatesfromsortedarray.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
11 lines (11 loc) · 278 Bytes
Breadcrumbs
leetcode
/
removeduplicatesfromsortedarray.java
Copy path
File metadata and controls
11 lines (11 loc) · 278 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
public
class
Solution
{
public
int
removeDuplicates
(
int
[]
nums
) {
if
(
nums
.
length
==
0
)
return
0
;
int
idx
=
0
;
for
(
int
i
=
1
;
i
<
nums
.
length
;
i
++)
if
(
nums
[
idx
]!=
nums
[
i
])
nums
[++
idx
]=
nums
[
i
];
return
idx
+
1
;
}
}
Back
|
FazBrowse Home
|
New Git URL