It is my interview question, use merge sort!!! There are some property:
1. index of left is always less than right
2. since i < j, s.t. a[i] > a[j], so we just need to calculate when a[i] > a[j]
Error:
1. we need to first calculate local then global, since we use & for A
2. know what you are doing!!! You are calculating some index
leetcode-775-Global and Local Inversions
最新推荐文章于 2020-01-16 09:03:06 发布