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

Day 177 #365

Closed
vaskoz opened this issue Feb 15, 2019 · 1 comment
Closed

Day 177 #365

vaskoz opened this issue Feb 15, 2019 · 1 comment
Assignees

Comments

@vaskoz
Copy link
Owner

vaskoz commented Feb 15, 2019

Good morning! Here's your coding interview problem for today.

This problem was asked by Airbnb.

Given a linked list and a positive integer k, rotate the list to the right by k places.

For example, given the linked list 7 -> 7 -> 3 -> 5 and k = 2, it should become 3 -> 5 -> 7 -> 7.

Given the linked list 1 -> 2 -> 3 -> 4 -> 5 and k = 3, it should become 4 -> 5 -> 1 -> 2 -> 3.

@vaskoz vaskoz self-assigned this Feb 15, 2019
@vaskoz
Copy link
Owner Author

vaskoz commented Feb 16, 2019

The original version of this problem statement had an error in the 2nd example input.

Written as:
Given the linked list 1 -> 2 -> 3 -> 4 -> 5 and k = 3, it should become 3 -> 4 -> 5 -> 1 -> 2.
Should be:
Given the linked list 1 -> 2 -> 3 -> 4 -> 5 and k = 3, it should become 4 -> 5 -> 1 -> 2 -> 3.

@vaskoz vaskoz mentioned this issue Feb 16, 2019
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