export function intersectionSortedArray(a: number[], b: number[]): number[] {
  let res: number[] = [];
  let aI = 0;
  let bI = 0;

  while (aI < a.length && bI < b.length) {
    let aValue = a[aI];
    let bValue = b[bI];

    if (aValue === bValue) {
      res.push(aValue);
      aI++;
      bI++;
    } else {
      aValue < bValue ? aI++ : bI++;
    }
  }

  return res;
};
