My code is not working. Please check out what mistake I made. Note: Instead of using next_permuation function I implemented my own permutation function to understand the concept.
My code: https://ide.codingblocks.com/s/413971
Problem: https://hack.codingblocks.com/app/practice/1/1098/problem