If you just want to do gamepads then yes it is easy to do a single row, but it would get whacky for keyboard codes because there are a lot of them and they don't go sequentially from 0 upwards. Typically starts at 8 (backspace) and goes to 222 (single quote) with lots of gaps in between.
i.e. near the end it goes 190,191,192,219,220,221,222
easier to just plonk both in the array and reference one from the other.