LeetCode: grid min paths, rotate list, permutation