I am trying to solve frequent values using Segment Tree
This blog article uses a similar approach
I want to split a list into intervals as:
-1 -1 1 1 1 1 3 10 10 10
becomes (0, 2) (2, 6) (6, 7), (7, 10)
I have a code as:
g s = map (\x->(head x, length x)) . group . sort $ s
But it does not give the correct output.
Is it possible with frequent values too?