|
|
|
|
|
by dullcrisp
1406 days ago
|
|
With only one repeated number, you can sum the array and subtract 1+…+n to get the answer. Still an annoying trick you wouldn’t expect in an algorithm problem. Though the leetcode version also doesn’t require linear time, so I guess you could just iterate and compare in quadratic time to solve it? |
|