Oct 28 (edited) • Random
PSA about Codewars solutions
Whats good yall
Just a quick PSA for those just starting coding problems, so yall can avoid the mistakes I made when starting out
I was practicing some Codewars, when I saw this solution at the top.
Although it looks very flashy because its 3 lines, its actually terrible!
The right solution is BigO(n), but this solution is BigO(n^3)!! As indexOf and lastIndexOf both loop through the array.
The next "Best Practices" solution uses an obscure mechanic, a ^ bitwise operator ! Imagine how hard it is to debug a codebase full of this flashy programming😭😭😭
The "Best Practice" practically speaking, is a solution that is easy to read and understand, even if it requires more lines of code.
So don't feel down if you're solution isn't haiku-level brief! If it's readable and understandable, its good.
🫡
10
5 comments
Thomas Stephenson
5
PSA about Codewars solutions
Developer Pro
skool.com/developerpro
Learn how to code. Make money. Have fun. Enjoy life.
Leaderboard (30-day)
Powered by