123456789101112131415161718192021222324252627282930 |
- import { ExtractNumbers } from "../common.ts";
- export function ParseInput(inputArr: string[]): Histogram[] {
- return inputArr.map((historyStr) => ExtractNumbers(historyStr) as Histogram);
- }
- export function FindDifferential(histogram: Histogram): Histogram {
- const differential: Histogram = [];
- for (let i = 1; i < histogram.length; i++) {
- differential.push(histogram[i] - histogram[i - 1]);
- }
- return differential;
- }
- export type Histogram = number[];
|