Problem

Given an int array, return true if 7 appears at index 0 or at the last index. The array has at least one element.

Examples

  • hasSevenAtEdge([4, 2, 7]) -> true
  • hasSevenAtEdge([7, 9, 1]) -> true
  • hasSevenAtEdge([2, 7, 5, 1]) -> false
Compile and test (Ctrl+Enter)