Implement prototype(allowed) and solve(allowed). Choose one string per inner array, never repeating a string. Return the lexicographically smallest complete assignment in original position order, or null if impossible. Duplicate choices within one list add no alternatives. Equality is exact; order is Unicode code-point lexicographic order using the supplied compareText.
[["A", "B"], ["A"]] returns ["B", "A"]; [["A"], ["A"]] returns null; [] returns []; [[]] returns null.
Prototype: enumerate complete combinations. Final: sorted unique options, early rejection and rollback. Preserve every input array. No extra validation is required; worst-case work remains exponential.
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.