Comment on Become a Better Programmer by Taking a Shower
abhibeckert@lemmy.world 1 year ago
$a = range(0, 10); /* 11 elements */ $n = count($a)-1; /* indexed 0..10 */ for ( $i=0; $i
Comment on Become a Better Programmer by Taking a Shower
abhibeckert@lemmy.world 1 year ago
$a = range(0, 10); /* 11 elements */ $n = count($a)-1; /* indexed 0..10 */ for ( $i=0; $i
davawen@programming.dev 1 year ago
That’s not the point of the article though. Reversing an array is simply an exemple of a very simple CS puzzle. Of course it’s common enough to have a builtin function. No, this won’t be written in a code base, or asked for a code review. That’s not the point.
abhibeckert@lemmy.world 1 year ago
I guess my point is, if you need to take a shower to figure out a solution… then I’m not sure it’s a good solution. Keep it simple.
apd@programming.dev 1 year ago
It’s an algorithm question. If somebody gave me your solution in an interview I would ask them to solve the problem without a dependency. These questions are about demonstrating your ability to code whilst understanding space & time complexity.