My Favorite CS Puzzle – An Interactive Walkthrough(assaf.dev)1 points·by assafk·vor 2 Jahren·2 commentsassaf.devMy Favorite CS Puzzle – An Interactive Walkthroughhttps://assaf.dev/blogs/my-favorite-cs-puzzle2 commentsPost comment[–]Sianko·vor 2 JahrenreplyI 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); ```[–]assafk·vor 2 JahrenreplyThis doesn't work if more than one value repeats itself.
printf("Element %d\r\n", sum); ```