Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fixedPointsPermutation(permutation)
- array_new = permutation.sort
- array_length = permutation.length
- x = 0
- sum = 0
- while (x < array_length)
- if permutation[x] == array_new[x] then
- sum = sum + 1
- end
- x = x + 1
- end
- return sum
- end
Advertisement
Add Comment
Please, Sign In to add comment