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.
That's a clever way to get around the 12AM logic check, I like it. As far as lines of assembly instruction, what you have probably saves a few lines; it's totally appropriate for this problem, but if you were ever dealing with input numbers larger than 12 it would become inefficient (calculating mod would become increasingly expensive). For this application though, what you wrote may be slightly more efficient; you'd have to run a benchmark to be sure.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
That's a clever way to get around the 12AM logic check, I like it. As far as lines of assembly instruction, what you have probably saves a few lines; it's totally appropriate for this problem, but if you were ever dealing with input numbers larger than 12 it would become inefficient (calculating mod would become increasingly expensive). For this application though, what you wrote may be slightly more efficient; you'd have to run a benchmark to be sure.