Design Excel Sum Formula — LeetCode 631 Python Solution

HardLeetCode PremiumGraphDesignTopological SortArrayHash TableStringMatrix
Problem
#631
Reading time
2 min

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

MeasureComplexity
TimeO(n)
SpaceO(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.

Stuck on problems like this in a live interview?

Stealth Interview is a desktop app for macOS and Windows. It reads the problem off your screen and returns a working solution with a step-by-step explanation and its time and space complexity — invisible to screen sharing.

Get Stealth Interview