DEV Community

Paolo Ventura
Paolo Ventura

Posted on

100 algos in 100 days (Day 34)

[21/10]
Which number appears twice in an array of numbers 1...n

Here we can use the trick that any triangular series the total sum will be 0.5n*(n+1).

A triangular series being any series where the numbers can form the rows of an equilateral triangle.

Top comments (0)