We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hi, I tried the above solution. However, I have some doubt.
m[a[i]] = m[s[i]]a[i], a[m[s[i]]] = s[i], a[i]
In the above code snippet, I had earlier tried with these two sentences swapped, which didn't give me a correct answer. I am not able to understand why swapping these statements made a difference.
Can you please give me insights on this?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Lily's Homework
You are viewing a single comment's thread. Return to all comments →
Hi, I tried the above solution. However, I have some doubt.
m[a[i]] = m[s[i]]
a[i], a[m[s[i]]] = s[i], a[i]
In the above code snippet, I had earlier tried with these two sentences swapped, which didn't give me a correct answer. I am not able to understand why swapping these statements made a difference. Can you please give me insights on this?