Amazon Interview Question

Its a problem related to maxBinary heap and other problem is about permutation using backtracking