Coding Battles - Clash of Code

preview_player
Показать описание
Coding battles are a fun way to practice coding, especially if you are learning a new language. It's also a good mental workout to keep that noggin sharp.

Clash of Code:

Cracking the Coding Interview (my favorite coding interview prep book):

Cracking the Coding Interview - Video with Danny:

Join our Discord community:

Connect with me:

Music:
Рекомендации по теме
Комментарии
Автор

A MISTAKE I MADE IN THE VIDEO:

In clash 4 (Shortest Mode), num is strange if: x^x + x = num, and num's constraints were: 0 < num < 2^32, so to find the range of x, I needed to solve this equation: 0 < x^x + x < 2^32, but when I tried to solve it in my head, I actually solved this equation: 0 < x^2 + x < 2^32, so my upper bound for x was way too high (noob error, shame 😔). What I should have done instead was enter something like "x^x+x = 2^32" into WolframAlpha to realize that x < 9.74309. So I really only had to check against values of x in the range 1 to 9. This also means I could have removed the "if not n%x" part that was only added to make it so I didn't run into the computation time limit because I was checking so many different values. So a better solution would have been "print(any(x**x+x==n for x in range(10)))".

elliotwaite
Автор

i think the short code mode should be replaced by something more usefull like fastest execution time

ep
Автор

I should have just written "print(min(m, n))" for that first one. I went old school with that if-else statement.

elliotwaite
Автор

It really worked for me after I look and try some tutorials, yours is the one that worked. Owe you a lot.

dentsudominicana
Автор

May I ask? For shortest mode, it is unfair as other language are presumably longer to execute a certain task such as printing, Java took multiple characters but Python only needed few. Do you acknowledge this?

iqmalaizatbinmohdzamri
Автор

made it into an arp using the default soft envelope generator and a bunch or other weird stuff I didn’t even know existed. Called it pants

MrHelloimyassin
Автор

that's pretty cool!
thanks for sharing

Bryan-bhcy
Автор

good work and thank you so much, Greetings from Egypt <333

arunverma
Автор

idk if I just suck at coding or what I can build responsive webpage but I tried playing this game and I just suck

Haloking
Автор

The strange numbers solutions were...strange.
You did it correctly, but for some reason you looped to the square root of 2^32 as if the check was x^2+x=num rather than x^x. (Seems it would be enough to loop 1 to 9.)
Even stranger was that the guy you checked did exactly that - i*i+i instead of i**i+i - and got 80% score.

Or I misunderstood something.

peter.g
Автор

is there a mode where they force coders to code with the same language; like java vs java coders. because some languages have shorter syntax than others and thats no fair if a coder code in a shorter syntax language vs a coder with long syntax language

sixihili
Автор

Would be nice if you could set which Clash modes you'll play in user settings. Fastest and reverse are fine, but for shortest mode, I just quit the clash. Pointless vs. Python and JS script kiddies, Ruby coders, et al.

Without this, the least CodinGame could do is to define aliases for common functions. I use F#, so instead of the ridiculous "System.Console.In.ReadLine" (which should be "System.Console.ReadLine" anyway), just define something like "let rl = System.Console.ReadLine". It's a lot fairer vs. stuff like "input" and "gets".

MiloDC
Автор

For the life of me, i don't understand the Test1, Test2... Test5 cases. What are those for?? Either your code works, or not. Why are there 5 tests? Because of this i only get 20%, i have no clue what to do with the other 4.

dannyrodin
Автор

Does anyone know why some solutions don't get 100% ? What is the criters to get the maximum ?

brieglhostis
Автор

hello why is clash of code a scheduled event now?

jsquaredm
Автор

I'm somewhat disappointed with the shortest mode. I always thought that making shorter code is not always better, and that a good code is one that is well understood. Making code shorter by being more cryptic is bad practice.

xbit_
Автор

thanks for the info really helped alot. i rather learn about tNice tutorials than school

hendaantonio
Автор

Shortest code puts other languages at a disadvantage, compared to Python.

Neolisk
Автор

Most of the challanges are made to be convenient solvable with python its often faster written and easy to find a "one line of code" solution with python. other languages ​​look bad next to it... this ist just stupid xD

saschareisen
Автор

@elliotwaite can you please mentor me to get into google?

thomasmbayo