Algorithm · Bloomberg · Medium
For a given long integer num, determine how many distinct expressions write it as the sum of at least two consecutive positive integers. For instance: When num = 9, there are two valid decompositions: (4 + 5) = (2 + 3 + 4) = 9. When num = 1, no such decomposition exists. Implement the consecutive_sum_count function in the editor. It receives one argument, the long integer num, and must produce an integer equal to the number of valid representations using two or more…