7 ms·
consider the following example where the condition "one ball is heavier than the others" holds true but your method yields the wrong solution: {1,10} vs {6,6}
by thisisfmu 15y ago
consider the following example where the condition "one ball is heavier than the others" holds true but your method yields the wrong solution: {1,10} vs {6,6}
when it is further specified that all remaining balls are of equal weight then your solution cannot be optimal since comparing two thirds yields the required information about the remaining third.
- thisisfmu 15y agodownvoter dumb. no hire.
- seabee 15y agoI didn't downvote you, but I think they object to your overly literal interpretation of "one ball is heavier than the others" given it was contrasted with the original phrasing "one ball is a different weight". This is a math puzzle, not a lateral thinking puzzle.
- thisisfmu 15y agoNot to draw this out further but I do think variations of these make for good interview questions for entry-level people. Here is why: First, it is trivial to communicate the problem and any moderately competent person will find a solution within a short time frame. Second, it tests how precisely someone takes a problem definition. (In my experience, the kind of person who glances over such details will also tend to make trivial programming mistakes like off-by-ones.) Third, by varying a well-known question slightly you can easily filter out those who have simply learned the "correct" solution from the internet rather than thinking it through.