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.
i think it's easier to explain with an example. say you want to get'abcde' from'abc'. the difference is 2, which is even (2%2==0). i can only have a k value that is even to reach abcde, any odd number won't work. likewise if i wanted to reach abcd (1%2==1), only an odd k would work. hope this clears it up
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Append and Delete
You are viewing a single comment's thread. Return to all comments →
i think it's easier to explain with an example. say you want to get'abcde' from'abc'. the difference is 2, which is even (2%2==0). i can only have a k value that is even to reach abcde, any odd number won't work. likewise if i wanted to reach abcd (1%2==1), only an odd k would work. hope this clears it up