i wrote a code custom input is running well but on submission it is giving wrong answer
here is my code, Please tell me the correct approach or correct my code
💡 Minimum Time Traversal
Solution of the problem is a brute force, as range of n is 1<= n<= 5.
you have to consider all possible combination of using the n pipes and then select the one with minimum value.
Total number of combination would be: 32*120.
32 = 2^5= total number of set of n pipes,
120= 5!= all permutation of those n pipes, so for all set we will have max 120 permutation.
You can have a look at my code here. Just implemented Recursion and test cases passed. You dont need to that swapping in your code, it just complicates it.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.