2 ms·
Ugly structures that don't map to clear concepts are worse than any special case. Padding array makes you go "wtf is that?" I would rather see something like
by LudwigNagasena 8y ago
Ugly structures that don't map to clear concepts are worse than any special case.
Padding array makes you go "wtf is that?"
I would rather see something like this:
(i > 0 ? input[i-1] : 0) + (i < input.size - 1 ? input[i+1] : 0)
which clearly maps to "if there is a left neighbor, add it; if there is a right neighbor, add it; return the sum."