Can anyone explain to me why I am getting TLE in this problem:- https://mirror.codeforces.com/contest/1526/problem/D. Here is my submission:- https://mirror.codeforces.com/contest/1526/submission/117731679. I just iterated over all the 24 permutations of "ANOT" and then formed the string and found the minimum swaps required for this string in O(n).(the counting part is taken from GFG which works in O(n)).
Thank you.