Implement prototype(loaded, requested) and solve(loaded, requested). Inputs are strings, including empty strings. Use the provided normalizeLetters helper for both inputs, and return an object containing only positive requestedCount - loadedCount deficits. Insert keys in ascending Unicode code-point order. Do not normalize further.
prototype("ab", "aaa") returns {a: 2}; either stage on "ß", "SS" returns {}. For "Aab!", "baaac", return {a: 1, c: 1} in that key order.
Prototype: rescan normalized letters for each distinct requested letter. Final: build frequency maps. Preserve input and leave the supplied helper unchanged. No additional errors are required.
All numeric inputs and finite arithmetic results in this lesson are safe-integer Numbers. Use null for documented absence, not undefined or a numeric sentinel. Return actual booleans where the contract requires them. Do not add validation requirements beyond the documented inputs.
String positions and lexicographic ordering in this exercise use Unicode code points. Array.from(text) and string iteration expose code points; text.length, indexing, and default string sorting use UTF-16 code units. Do not substitute locale collation or add Unicode normalization.
Run with Node.js 20+ from this directory:
node main.mjs --stage prototype
node main.mjs --stage finalEdit exercise.mjs; keep main.mjs unchanged. Both stages begin as unfinished learner functions. The website uses the same test functions in a separate browser worker. Tests check deterministic examples, boundaries, documented validation, input preservation, and stage-specific cases. Passing tests does not prove the required time complexity.
Complete the starter code, then run the checks.
Results and errors will appear here.