Coding style nit: `arr` → `array`, `res` → `result`. No need to be brief; we have minifiers for that.