[HAI] twoSumHashtable update taste cases
This commit is contained in:
@@ -2,13 +2,17 @@ import { describe, it, expect } from "vitest";
|
|||||||
import { twoSumHashTable } from "./twoSumHashTable.ts";
|
import { twoSumHashTable } from "./twoSumHashTable.ts";
|
||||||
|
|
||||||
describe("twoSumHashTable", () => {
|
describe("twoSumHashTable", () => {
|
||||||
let sortedArray = [-12, 1, 4, 6, 22];
|
|
||||||
|
|
||||||
it("twoSumHashTable", () => {
|
it("[2,7,11,15], 9 => [0, 1]", () => {
|
||||||
expect(twoSumHashTable(sortedArray, 4)).toBe(2);
|
expect(twoSumHashTable([2, 7, 11, 15], 9)).toEqual([0, 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("twoSumHashTable", () => {
|
it("[3,2,4], 6 => [1, 2]", () => {
|
||||||
expect(twoSumHashTable(sortedArray, 3)).toBe(-1);
|
expect(twoSumHashTable([3, 2, 4], 6)).toEqual([1, 2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("[3, 3], 6 => [0, 1]", () => {
|
||||||
|
expect(twoSumHashTable([3, 3], 6)).toEqual([0, 1]);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user