Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Timeline for Reduce a number by its largest digit

Current License: CC BY-SA 3.0

12 events
when toggle format what by license comment
Nov 21, 2017 at 23:17 comment added recursive Those particular backticks were particularly bothering me. You were right, of course, about why they're needed in this solution. But I rearranged it to eliminate them and save a byte. It uses if ... else. tio.run/##NYzBDsIgEAXvfAW3sqYxYaEgTfRbigppE7qSilG/…
Nov 21, 2017 at 22:16 comment added FlipTack @recursive No, as then if n was 0 then n*(n<=9) would still evaluate to a falsy value, 0, making the recursion continue and causing an error, whereas the string '0' is a truthy value and therefore the recursion is halted.
Nov 21, 2017 at 22:06 comment added recursive I believe you can remove the first set of backticks.
Nov 20, 2017 at 18:15 comment added FlipTack @JamesWebster should be fixed now.
Nov 20, 2017 at 18:15 history edited FlipTack CC BY-SA 3.0
added 4 characters in body
Nov 20, 2017 at 13:25 comment added James Webster This seems to fail for the test case 432969. "ValueError: invalid literal for int() with base 10: ''"
Nov 19, 2017 at 8:12 history edited FlipTack CC BY-SA 3.0
deleted 8 characters in body
Nov 19, 2017 at 7:27 comment added RoryT I'm getting an error on input 9
Nov 18, 2017 at 20:33 history edited FlipTack CC BY-SA 3.0
added 4 characters in body
Nov 18, 2017 at 20:21 comment added totallyhuman ...I was debugging a dumb mistake in this. Darn, I got ninja'd.
Nov 18, 2017 at 20:21 history edited FlipTack CC BY-SA 3.0
added 6 characters in body
Nov 18, 2017 at 20:15 history answered FlipTack CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /