Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate Array in java #283

Open
Sofiyan-coder opened this issue Oct 16, 2024 · 1 comment
Open

Rotate Array in java #283

Sofiyan-coder opened this issue Oct 16, 2024 · 1 comment
Assignees

Comments

@Sofiyan-coder
Copy link

Sofiyan-coder commented Oct 16, 2024

Given an integer array nums, rotate the array to the right by k steps, where k is non-negative.


Example 1:


Input: nums = [1,2,3,4,5,6,7], k = 3


Output: [5,6,7,1,2,3,4]


Explanation:


rotate 1 steps to the right: [7,1,2,3,4,5,6]


rotate 2 steps to the right: [6,7,1,2,3,4,5]


rotate 3 steps to the right: [5,6,7,1,2,3,4]


Example 2:


Input: nums = [-1,-100,3,99], k = 2


Output: [3,99,-1,-100]

Explanation:

rotate 1 steps to the right: [99,-1,-100,3]

rotate 2 steps to the right: [3,99,-1,-100]

Leetcode Problem link

@Sofiyan-coder
Copy link
Author

@DhanushNehru assign me this I would like to work on it. To start my open source contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant