naive and O(1) solution
added runtime