1. [OA] Backtracking — Generate Notion-like Markdown from block types
Notion allows users to create various types of blocks that can include textual content, images, and to-do lists. We want to generate all possible Markdown representations from given block types. The task is to implement a function to produce all combinations of Markdown representations for these blocks using backtracking.Function Signature: - def generateMarkdown(blocks: List[str]) -> List[str]: where blocks contains strings representing different block types like 'text', 'image', 'todo'.Example 1: Input: blocks = ['text', 'image'] Output: ['text', 'image', 'text image', 'image text'] Explanation: Each block can occupy a position individually or combined in a sequence.Example 2: Input: blocks = ['text', 'todo'] Output: ['text', 'todo', 'text todo', 'todo text']Constraints: - 1 <= blocks.length <= 10 - blocks[i] consists of unique types only.
codingHardsliding window#2
2. [OA] Sliding Window — Calculate current view state in Notion’s real-time collaboration
In Notion, when many users are editing a shared document, we need to maintain a view of their changes in real time. Using the sliding window technique can help us efficiently track the changes. The problem is to implement a function that can track the number of changes made within a specific viewing window of time.Function Signature: - def countChanges(changes: List[Tuple[int, int]], window: int) -> int: where changes is a list of tuples representing changes with start and end times.Example 1: Input: changes = [(1, 4), (2, 5), (5, 7)], window = 3 Output: 3 Explanation: Changes are made at times 1, 2, 4, 5, 6, 7; within the window [1, 4], there are 3 changes.Example 2: Input: changes = [(1, 2), (2, 6), (5, 10)], window = 5 Output: 3 Explanation: All changes occur within the single 5 unit time frame.Constraints: - 1 <= changes.length <= 10^5 - 1 <= changes[i][0], changes[i][1] <= 10^9
Start practicing Notion questions
Sign up for free to access walkthroughs, AI-generated questions, and more.