HardNo. 0631LeetCode Premium
Design Excel Sum Formula — LeetCode 631 Python Solution
- Pattern
- Topological Sort
- Topics
- Graph, Design, Topological Sort, Array, Hash Table, String, Matrix
- 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
- Time
- O(n)
- Space · auxiliary
- O(n)
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
| No. | Problem | Difficulty |
|---|---|---|
| 2115 | Find All Possible Recipes from Given Supplies | Medium |
| 0745 | Prefix and Suffix Search | Hard |
| 2166 | Design Bitset | Medium |
| 2227 | Encrypt and Decrypt Strings | Hard |
| 2353 | Design a Food Rating System | Medium |
| 0036 | Valid Sudoku | Medium |
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.