News for hackers. Stuff that matters.
Re:My Favorite CS Puzzle – An Interactive Walkthrough by Sianko on Monday November 25, 2024 @01:20PM (#42238620)
I think the value of a repeated number can be found much easier: ``` long sum = 0; for (int i = 0; i < n; i++) { if(i < n - 1) { sum -= i; } sum += array[i]; }

printf("Element %d\r\n", sum); ```

Re:My Favorite CS Puzzle – An Interactive Walkthrough by assafk on Wednesday November 27, 2024 @04:46AM (#42254581)
This doesn't work if more than one value repeats itself.