Ad
  • Custom User Avatar

    This solution is wrong because it counts things like '>:D' and ':)-' as valid smiley faces. From the original description: "No additional characters are allowed except for those mentioned."

  • Custom User Avatar

    Some problems are inherently mathematical. And often, a mathematical solution is necessary, otherwise the computation is intractable. You might like to know that computers were basically invented to solve mathematical problems that had undergone 'mathematical transformations'.

  • Custom User Avatar

    Except that it's not a general algorithm. It still needs extra logic. Consider another situation where the ticket price in $20 and we have bills worth 10, 20, 50, and 100. When giving change for $100, one solution is to give back 4 $20 bills. But this algorithm can miss such a solution by giving $50 first and then realizing it doesn't have enough $10 bills to complete the transaction.