Implement prototype(jobs) and solve(jobs). Each job is [uniqueId, start, end] with integer times and end>start. Invalid durations throw RangeError; IDs identify unique jobs. Empty input returns [].
Return IDs in the exact order obtained by sorting jobs by end, start, then Unicode code-point ID order and greedily accepting start>=last accepted end. Touching jobs are compatible. [["b", 0, 2], ["a", 0, 2], ["c", 2, 3]] returns ["a", "c"].
Prototype: explore subsets but reproduce that canonical optimum. Final: earliest-finish selection, O(n log n). Use the supplied compareText for ID ordering. Preserve all input records, including on failure.
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.