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.
Or in C/C++:
#include <stdio.h>
void main () {
int x = -1782062727;
int y = 1688372559;
printf("Result: %d", x * y);
}
There is overflow. Try this:
console.log(Math.imul(-1782062727, 1688372559))
Yes.
Both of the multiplications are wrong, are we supposed to emulate it?
When you multiply int32 by int32 that is what you get.
With JS "number" (aka Float64), you get -1782062727 * 1688372559 = -3008785806683508000
But in bitwise operations, JS is int32. And for multiplying int32s, you have this: Math.imul(-1782062727, 1688372559) = 56914263
I put Math.imul in the public tests as the standard, so it's not unfair, imho.
Invalidated the first two cheats / should have eliminated other super-low-hanging fruit. Keep the cheats coming!
I searched pretty thoroughly and didn't find anything else like this. A lot of text stuff and some karatsuba, etc. But not bitwise only.
And if there was, getting a non-cheating solution to pass the full test in time is actually not trivial. But if this is a duplicate, send me the link and I'll get rid of it.
This is also my first kata, so I'm very happy to take suggestions/guidance on anti-cheating measures and other ideas for improvement.
Anti-cheat measures are too weak, as you can see with current solutions.
Also, I think something like this has been done already.