[HAI] week3 intersection array

https://www.interviewbit.com/problems/intersection-of-sorted-arrays/
This commit is contained in:
2024-12-08 21:12:56 +03:00
parent 656b5c6eb5
commit 807a5ae9cf
4 changed files with 146 additions and 0 deletions
@@ -0,0 +1,13 @@
import { describe, it, expect } from "vitest";
import { intersectionSortedArray } from "./intersectionSortedArray.ts";
describe("intersectionSortedArray", () => {
it("[1,2,3,3,4,5,6] [3,3,5] => [3,3,5]", () => {
expect(intersectionSortedArray([1, 2, 3, 3, 4, 5, 6], [3, 3, 5])).toEqual([3, 3, 5]);
});
it("[1,2,3,4,5,6] [3,5] => [3,5]", () => {
expect(intersectionSortedArray([1, 2, 3, 4, 5, 6], [3, 5])).toEqual([3, 5]);
});
});