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.
Hmm, that depends, the function in the assignement is said to be, f:X -> X. That is the domain and codomain are the same sets. Now, in your input n=3 that is X = {1, 2, 3}. So, by the definition you should only use those values for the outputs (4 is forbidden). From the definition in the assignement f is basically a permutation of {1, 2, ... , n} for some positive n.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Security Bijective Functions
You are viewing a single comment's thread. Return to all comments →
Hmm, that depends, the function in the assignement is said to be, f:X -> X. That is the domain and codomain are the same sets. Now, in your input n=3 that is X = {1, 2, 3}. So, by the definition you should only use those values for the outputs (4 is forbidden). From the definition in the assignement f is basically a permutation of {1, 2, ... , n} for some positive n.