This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface SnapshotRow { | |
| readonly sym: string | |
| readonly cost: number | |
| } | |
| /** | |
| * Removes outdated items from the snapshot. | |
| * @param snapshot | |
| */ | |
| export function stockQueue(snapshot: SnapshotRow[]): SnapshotRow[] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Rotates the incoming matrix 90deg | |
| * @param matrix | |
| */ | |
| export function rotate90deg(matrix: unknown[][]): void { | |
| const n = matrix.length === 0 ? 0 : matrix[0].length | |
| for (let ring = 0; ring < Math.floor(n / 2); ring++) { | |
| for (let position = ring; position < n - ring - 1; position++) { | |
| const backupRight = matrix[position][n - ring - 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface MapItem<T> { | |
| readonly key: string, | |
| readonly value: T | |
| } | |
| /** HashMap implementation using a 2D array */ | |
| class ArrayHashMap<T> { | |
| /** | |
| * Buckets where data will be stored | |
| * |