Tal Tab wrote:I'd really like to learn what would be an acceptable solution...
BTW, the music files were just an example. It should work for any file types.
Much of the time, they're not asking you this question to see what solution you have. It's to see how you approach problems. One of the worst things you can do as a coder is immediately start writing code, or deciding on an implementation strategy before you understand the problem. The best thing to do is push back, and find out what the parameters are. Look for edge cases. think outside the box.
you can't have an acceptable solution until you know as many details as possible. so again, what makes two files the "same"? If one file has an addition second of silence on the end, but is otherwise identical, is that the same? What if it's byte-for-byte identical, but one came from a studio album, and another came from a greatest hits compilation? What if one file name is in all caps, but another has mixed case?
unless you have the answers to these questions (and many others), you really can't come up with a solution.