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 360 #709

Closed
vaskoz opened this issue Aug 17, 2019 · 1 comment · Fixed by #711
Closed

Day 360 #709

vaskoz opened this issue Aug 17, 2019 · 1 comment · Fixed by #711
Assignees

Comments

@vaskoz
Copy link
Owner

vaskoz commented Aug 17, 2019

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

This problem was asked by Spotify.

You have access to ranked lists of songs for various users. Each song is represented as an integer, and more preferred songs appear earlier in each list. For example, the list [4, 1, 7] indicates that a user likes song 4 the best, followed by songs 1 and 7.

Given a set of these ranked lists, interleave them to create a playlist that satisfies everyone's priorities.

For example, suppose your input is {[1, 7, 3], [2, 1, 6, 7, 9], [3, 9, 5]}. In this case a satisfactory playlist could be [2, 1, 6, 7, 3, 9, 5].

@vaskoz vaskoz self-assigned this Aug 17, 2019
@vaskoz
Copy link
Owner Author

vaskoz commented Aug 18, 2019

Simple https://en.wikipedia.org/wiki/Topological_sorting#Depth-first_search of the graph combined of each playlist.

@vaskoz vaskoz mentioned this issue Aug 18, 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