in this question there could be a corner case, when n = 10 ;
so the best position of 10 would not be at the start of the line but rather at the end .
why is that case not considered here ??
in this question there could be a corner case, when n = 10 ;
so the best position of 10 would not be at the start of the line but rather at the end .
why is that case not considered here ??
Hello @Vishesh-Chaitanya-1475805525886480 could you please explain your point in more structured form so that i can keep that with the team?
Sir , like if we have n = 10 and k = 2 ;
and we are given input as 9 10 8 7 6 5 2 1 3 4 , so the biggest number that could be formed with these would be 98765432110,but in the explanation video , the number is said to have position n-(the number) , so if we take 10 as the number,then its bestPosition will be 0 but if we put 10 at 0th position , it will not make the biggest number , rather putting 9 at the 0th position will give us the bigger number
so i guess the explanation doesn’t hold true for this case
@Vishesh-Chaitanya-1475805525886480 in question we are not asked to find the biggest number we have to find the biggest permutation and for that biggest number will come first only.
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.