Compute the Number of Breakpoints in a Permutation solved by 577

Jan. 21, 2014, 12:05 a.m. by Rosalind Team

Number of Breakpoints Problem

Find the number of breakpoints in a permutation.

Given: A signed permutation P.

Return: The number of breakpoints in P.

Sample Dataset

(+3 +4 +5 -12 -8 -7 -6 +1 +2 +10 +9 -11 +13 +14)

Sample Output

8

Extra Dataset

Please login to solve this problem.