Implement prototype(tokens) and solve(tokens). Each reached token must be exactly LOAD:<nonempty-label> or UNLOAD:<nonempty-label> with exactly one colon. A malformed reached token throws RangeError.
Return whether the whole sequence is valid LIFO order; [] returns true and unmatched loads at the end return false. Return false at the first ordering violation without inspecting later tokens: ["UNLOAD:x", "bad"] returns false. A reached "LOAD:" throws RangeError.
Prototype: adjacent-pair reduction preserving that processing rule. Final: a stack. Preserve the token array on success and 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.
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.