function frog1(numStones, stones) {
  let cur = 2;
  let mem = [0, Math.abs(stones[0] - stones[1])]
  while (cur < numStones ) {
    let jump1 = Math.abs(stones[cur] - stones[cur - 1]) + mem[cur - 1];
    let jump2 = Math.abs(stones[cur] - stones[cur - 2]) + mem[cur - 2];
    mem[cur] = Math.min(jump1, jump2);
    cur += 1;
  }
  return mem[mem.length - 1];
}