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 sincerely doubt that it was part of the exercise as it's not in line with any other exercise that I've seen on this site. And while it is easy to fix, I assume that at least some of the people who come here are coming to learn to code. That being the case, the provided code samples should at least work, and ideally, they should be examples of good coding.
It's also worth noting that if someone trusted the provided code, didn't really understand that it was wrong, much less why, and wanted to solve the exercise without "cheating" by looking up the answer, then it would make thier lives much, much harder. At that point, they're no longer solving the exercise. They're debugging someone else's badly written code. A useful exercise to be sure, but not the one this hypothetical person signed up for, and not one that they're aware they're engaged in.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cats and a Mouse
You are viewing a single comment's thread. Return to all comments →
I sincerely doubt that it was part of the exercise as it's not in line with any other exercise that I've seen on this site. And while it is easy to fix, I assume that at least some of the people who come here are coming to learn to code. That being the case, the provided code samples should at least work, and ideally, they should be examples of good coding.
It's also worth noting that if someone trusted the provided code, didn't really understand that it was wrong, much less why, and wanted to solve the exercise without "cheating" by looking up the answer, then it would make thier lives much, much harder. At that point, they're no longer solving the exercise. They're debugging someone else's badly written code. A useful exercise to be sure, but not the one this hypothetical person signed up for, and not one that they're aware they're engaged in.