Morgan Stanley Interview Question

Given a string find distinct permutations of that string, eg ABC => BAC,CAB,BCA.. Sort array elements IN PLACE making even and odd number together MCQ's were based on static nested classes, exception behaviour in inheritance.. nothing fancy here