As reported: Workday Senior Software Engineer round 2, coding on HackerRank (2025): design a document creator system that maintains versions, retrieves all versions, and allows updates only on the latest version. The focus was OOP, with questions on
ArrayListvsHashMapvsLinkedHashMap, returning immutable objects, and avoiding race conditions.
Design and implement:
createDocument(title, content)→ a document with version 1.update(documentId, baseVersion, newContent)→ creates the next version, but only ifbaseVersionis the latest; otherwise reject.getLatest(documentId)andgetAllVersions(documentId)in order.- Returned objects must not let callers change stored state.
- Concurrent updates to the same document must not corrupt the history.