Y
Hacker News
new
|
ask
|
show
|
jobs
by
sanedigital
1406 days ago
Sum the input list, sum the list of [1...n], subtract and voila!
1 comments
robbie-c
1406 days ago
Yeah, sadly you're not guaranteed some of the things that are needed for this to work. I defo believe the story that it took Knuth a day to figure this out, although when you see the answer it's pretty easy to understand.
link
sanedigital
1406 days ago
What things? I submitted it as an answer on Leetcode and it was accepted.
link