HackerRank C++ Solution – Simple Text Editor

Опубликовано: 04 Июль 2026
на канале: JustWriteTheCode
1,438
16

I JustWriteTheCode of the solution to the "Simple Text Editor" problem present on HackerRank (1 Week Preparation Kit - Day 6).

Programming Language: C++.

Problem:
Implement a simple text editor. The editor initially contains an empty string, S. Perform Q operations of the following 4 types:
1. append(W) - Append string W to the end of S.
2. delete(k) - Delete the last k characters of S.
3. print(k) - Print the k-th character of S.
4. undo() - Undo the last (not previously undone) operation of type 1 or 2, reverting S to the state it was in prior to that operation.