Implement Terminal Tabs and Split Panels
WarpSoftware Engineer · Technical ScreenLast updated
This question evaluates the ability to design and implement hierarchical data structures, model tree-based panel layouts, and perform precise serialization/deserialization of nested UI state.
Implement a data structure that models a terminal application with multiple tabs and split panels.
Requirements:
- A
Terminalcan create and store multiple tabs. - Each
Tabcontains a panel layout. - A
Panelcan be split into child panels, similar to how terminal panes can be split horizontally or vertically. - Model the panel layout as a tree, where each split creates child panel nodes.
- Implement methods to:
- Create a new tab.
- Split an existing panel inside a tab.
- Serialize the full terminal state, including all tabs and nested panel layouts.
- Deserialize the serialized state back into an equivalent
Terminalobject. - The serialization format should preserve all nesting levels and split information exactly.
- Write at least one test case that creates tabs, performs nested panel splits, serializes the terminal, deserializes it, and verifies that the reconstructed structure matches the original.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.