learn from others

O(n)