Design Excel Sum Formula — LeetCode 631 Python Solution
- Problem
- #631
- Pattern
- Topological Sort
- Reading time
- 2 min
- Source
- leetcode.com
The problem
Design the basic function of Excel and implement the function of the sum formula. Implement the Excel class: Excel(int height, char width) Initializes the object with the height and the width of the sheet.
Example
- Input
- ["Excel", "set", "sum", "set", "get"]
- Output
- [null, null, 4, null, 6]
- Explanation
- Excel excel = new Excel(3, "C");
Complexity
| Measure | Complexity |
|---|---|
| Time | O(n) |
| Space | O(n) auxiliary |
Pattern: Topological Sort
Order a set of tasks so that every dependency comes before the thing that needs it. LeetCode 631. Design Excel Sum Formula is filed here because LeetCode tags it Topological Sort, which is the vocabulary this hub collects.
The topological sort guide has the Python template for the pattern and the 32 LeetCode problems that use it.
Related problems
Frequently asked questions
- How hard is LeetCode 631. Design Excel Sum Formula?
- LeetCode 631. Design Excel Sum Formula is rated Hard on LeetCode.
- What is the time complexity of LeetCode 631. Design Excel Sum Formula?
- The Python solution on this page runs in O(n).
- What is the space complexity of LeetCode 631. Design Excel Sum Formula?
- The Python solution on this page uses O(n) auxiliary space.
- What topics does LeetCode 631. Design Excel Sum Formula cover?
- LeetCode 631. Design Excel Sum Formula is tagged Graph, Design, Topological Sort, Array, Hash Table, String and Matrix on LeetCode.
- Is LeetCode 631. Design Excel Sum Formula a premium problem?
- Yes. LeetCode 631. Design Excel Sum Formula is a LeetCode Premium problem, so the full statement and test cases require a paid LeetCode subscription.