Hello, I was trying to solve the 2nd most solved problem in the June cookoff 2k18 contest, even though I believe my approach is valid however still i would like to seek your review and suggest me any better approach or flaw in my existing approach, I will not be posting entire code but just basic algorithmic idea. My code isn't getting accepted (WA) probably due to side cases, and since I urgently want to know the validity of my approach I'm posting it here. APPROACH (for the single test case)
here, in the first ever call to permute, beg = 0 and end = ind.size()1 where k is mentioned in the problem statement of the question. Time complexity of the permute method is O(N^2 * fact(N)) If in case anyone is interested to check out entire code for further detail, please check this out https://www.codechef.com/viewsolution/18947214 If the algorithm is not clear please do let me know so I can write it more clearly. asked 19 Jun '18, 17:16
