first solution for array inversion count @ codility - 80/100
first solution for triangle @ codility - not 100%