Finding the Sum up array having numbers sum[1,n] = n*(n+1)/2 The sum of the squares of the first (n) natural numbers sum[1,n]^2 = n*(n+1)*(2n+1)/6


110 (binary) to (int) val = val*2 + node.val at last ans = 6