A memoize wrapper caches results in a Map keyed by JSON.stringify(args). Which input pair will cause an incorrect cache HIT (returning a stale wrong result)?
function memoize(fn) {
const cache = new Map();
return (...args) => {
const key = JSON.stringify(args);
if (cache.has(key)) return cache.get(key);
const r = fn(...args);
cache.set(key, r);
return r;
};
}