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.
you'd better google all the terms and understand what they do ^^
I just create a dictionary with the Y values' indexes as key (from the description, indexes start from 1, which python enumerate starts from 0 hence the x+1)
Then I simply check that all f[f[y]] == y is true for all values of Y, and print YES/NO depending on the result.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Security Involution
You are viewing a single comment's thread. Return to all comments →
you'd better google all the terms and understand what they do ^^
I just create a dictionary with the Y values' indexes as key (from the description, indexes start from 1, which python enumerate starts from 0 hence the x+1) Then I simply check that all f[f[y]] == y is true for all values of Y, and print YES/NO depending on the result.