FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programs/Rotate_Array.java at master · pooja2405/Java-Programs · GitHub
pooja2405
/
Java-Programs
Public
forked from
codec-akash/DSA-PS-Java-Programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programs
/
Rotate_Array.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
14 lines (14 loc) · 358 Bytes
Breadcrumbs
Java-Programs
/
Rotate_Array.java
Copy path
File metadata and controls
14 lines (14 loc) · 358 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
12
13
14
//https://leetcode.com/problems/rotate-array/
class
Solution
{
public
void
rotate
(
int
[]
nums
,
int
k
) {
for
(
int
i
=
0
;
i
<
k
;
i
++){
int
temp
=
nums
[
nums
.
length
-
1
];
int
j
=
nums
.
length
-
2
;
while
(
j
>=
0
){
nums
[
j
+
1
] =
nums
[
j
];
j
--;
}
nums
[
0
] =
temp
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL