Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
As guriyeller correctly observes, for all numbers greater than 1, multiplying will give the maximum result. So I special-cased where numbers are equal to 1, because then it's better to add them to another multiplier. For
a
andc
that can only be tob
, forb
it depends on whethera<c
or not;(a+1)c==ac+c
anda(c+1)==ac+a
. I made use of invariants throughout the various steps to arrive at a compact final expression, carefully avoiding overwriting values. All paths that add to variables make sure the correct variables are still 1 to not affect the result.i love your solution, you must be an Obfuscated C code contestant ;-)
you inspired my insanity ;)
@roswold. But that's not shorter unless you are counting whitespace. You gained the
,
Frack me, it looks awful.
This comment is hidden because it contains spoiler information about the solution
I... I think I need a proof.
Good question! Good question indeed... ))
@pvtroswold
Looks Yummy , Revised and APPROVED
This is my solution and Troj2 is a copycat (copied solutions in other kata as well).
You can figure out how this solution works by reading this comment (you need to solve a simple 8 kyu kata first).
This comment is hidden because it contains spoiler information about the solution
NASM 2.11 on Linux, assembled with
nasm -f elf64
.https://github.com/Codewars/codewars.com/wiki/Language-NASM
Maybe someone can help you if you pasted your solution marking with spoiler flag.