permutation related problems