Problem

Return index of target in sorted arr using a loop (binary search), or -1.

Examples

  • binarySearchIter([1, 3, 5], 3) -> 1
  • binarySearchIter([1, 3, 5], 4) -> -1
Compile and test (Ctrl+Enter)