PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Clickup

Process document edit events

Last updated: Apr 6, 2026

Quick Overview

This question evaluates implementing and manipulating a line-based document through sequential event processing, emphasizing array/list operations, string handling, and state management; it belongs to the Coding & Algorithms domain and tests data-structure and input-event processing competency.

  • medium
  • Clickup
  • Coding & Algorithms
  • Software Engineer

Process document edit events

Company: Clickup

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Implement a line-based document editor. You are given: - an initial document represented as an array of strings, where each string is one line - a list of events in chronological order Each event is one of the following: 1. `{"type": "insert_line", "index": i, "text": s}`: insert a new line `s` at 0-based position `i`. Valid positions are from `0` to `document.length`. 2. `{"type": "delete_document"}`: delete the entire document so it becomes empty. Apply all events in order and return the final document as an array of strings. Be careful about corner cases such as inserting into an empty document, inserting at the beginning or end, multiple `delete_document` events in a row, and additional edits after the document has been deleted.

Quick Answer: This question evaluates implementing and manipulating a line-based document through sequential event processing, emphasizing array/list operations, string handling, and state management; it belongs to the Coding & Algorithms domain and tests data-structure and input-event processing competency.

Clickup logo
Clickup
Dec 15, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
1
0

Implement a line-based document editor.

You are given:

  • an initial document represented as an array of strings, where each string is one line
  • a list of events in chronological order

Each event is one of the following:

  1. {"type": "insert_line", "index": i, "text": s} : insert a new line s at 0-based position i . Valid positions are from 0 to document.length .
  2. {"type": "delete_document"} : delete the entire document so it becomes empty.

Apply all events in order and return the final document as an array of strings.

Be careful about corner cases such as inserting into an empty document, inserting at the beginning or end, multiple delete_document events in a row, and additional edits after the document has been deleted.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Clickup•More Software Engineer•Clickup Software Engineer•Clickup Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.