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 324 #658

Closed
vaskoz opened this issue Jul 12, 2019 · 0 comments · Fixed by #659
Closed

Day 324 #658

vaskoz opened this issue Jul 12, 2019 · 0 comments · Fixed by #659
Assignees

Comments

@vaskoz
Copy link
Owner

vaskoz commented Jul 12, 2019

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

This problem was asked by Amazon.

Consider the following scenario: there are N mice and N holes placed at integer points along a line. Given this, find a method that maps mice to holes such that the largest number of steps any mouse takes is minimized.

Each move consists of moving one mouse one unit to the left or right, and only one mouse can fit inside each hole.

For example, suppose the mice are positioned at [1, 4, 9, 15], and the holes are located at [10, -5, 0, 16]. In this case, the best pairing would require us to send the mouse at 1 to the hole at -5, so our function should return 6.

@vaskoz vaskoz self-assigned this Jul 12, 2019
@vaskoz vaskoz mentioned this issue Jul 13, 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

Successfully merging a pull request may close this issue.

1 participant