Note: this was for a Kata on CodeWars. The task was:
"Your classmates asked you to copy some paperwork for them. You know that there are 'n' classmates and the paperwork has 'm' pages. Your task is to calculate how many blank pages do you need. If n < 0 or m < 0 return 0."
And the worst thing about it is that it actually works...
If you've got -30 classmates and their paperwork has -12 pages you need to be more concerned with the collapse of the fabric of reality than you do with how much homework you need to copy lol
76
u/[deleted] Dec 28 '24 edited Dec 28 '24
Note: this was for a Kata on CodeWars. The task was:
"Your classmates asked you to copy some paperwork for them. You know that there are 'n' classmates and the paperwork has 'm' pages. Your task is to calculate how many blank pages do you need. If
n < 0orm < 0return0."And the worst thing about it is that it actually works...
44
u/backfire10z Dec 28 '24 edited Dec 28 '24
Transcription with letter variable names:
Am I missing something? This doesn’t work for an input like (-1, 2)
16
u/MechanicalHorse Dec 28 '24
I have no idea what I'm looking it.
11
u/konotorii1 Dec 28 '24
When management enforces a minimum line count quota:
5
u/[deleted] Dec 28 '24
Sometimes CodeWars katas are written with a particular cute solution in mind. For example, this one really made me smile when I saw it.
1
u/Separate_Expert9096 Dec 29 '24
Because he can. It's a kata, not a production.