Comment Comment by paulsutter Who wouldn’t just sort the array and check it? His solution is very brittle: it fails in so many ways if the data had unexpected properties.Real world requirements usually contain inaccurate assumptions. He spent days to find a terrible answer, when the obvious solution is much better parent paulsutter 4 years ago
Real world requirements usually contain inaccurate assumptions. He spent days to find a terrible answer, when the obvious solution is much better