O(n)
accept solution