Problem

Sum left to right; when you see 15, skip that element and the one immediately after it (if 15 is last, skip only it).

Examples

  • sumSkipFifteen([1, 2, 15, 2, 1]) -> 6
  • sumSkipFifteen([15, 1, 2]) -> 3
  • sumSkipFifteen([2, 3, 4]) -> 9
Compile and test (Ctrl+Enter)