v2 time O(n) space O(n) Accepted

well it's not ArrayList.append it's **ArrayList.add**