Hash instead of array here is better (O(1) vs O(n) on access).