Solve 2025-07

This commit is contained in:
2025-12-07 12:40:54 +01:00
parent 6fbb902b32
commit 63a7a93aba
5 changed files with 109 additions and 0 deletions
+12
View File
@@ -11,6 +11,18 @@ export class MultiMap<V, K extends unknown[]> extends Map<K[0], any> {
}
return this.get(firstKey) as V;
}
multiHas(...keys: K): boolean {
const firstKey = keys[0];
const otherKeys = keys.slice(1);
if (!this.has(firstKey)) {
return false;
}
if (otherKeys.length > 0) {
return (this.get(firstKey)! as MultiMap<any, any>).multiHas(...otherKeys);
}
return this.has(firstKey);
}
multiSet(value: V, ...keys: K) {
const firstKey = keys[0];