Skip to content

Commit

Permalink
--
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirPaulb committed May 19, 2024
1 parent 79c6665 commit 456a21a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
11 changes: 6 additions & 5 deletions content/posts/problems/basic-calculator-iii.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ math: true

# [772. Basic Calculator III](https://leetcode.com/problems/basic-calculator-iii)

[Solve on LintCode](https://www.lintcode.com/problem/849/)
[**Solve on LintCode**](https://www.lintcode.com/problem/849/)

## Description

Expand Down Expand Up @@ -62,10 +62,10 @@ math: true

## Solutions

[**Read: Solving Basic Calculator I, II, III on leetcode**](https://medium.com/@CalvinChankf/solving-basic-calculator-i-ii-iii-on-leetcode-74d926732437)
Read: [***Solving Basic Calculator I, II, III on leetcode***](https://medium.com/@CalvinChankf/solving-basic-calculator-i-ii-iii-on-leetcode-74d926732437)

### Approach 1:
[SAME as Basic Calculator I Approach 1](/posts/basic-calculator/#Approach 1)
SAME as [***Basic Calculator I: Approach 1***](https://samirpaulb.github.io/posts/basic-calculator/#approach-1)

{{< terminal title="Python Code" >}}
```python
Expand Down Expand Up @@ -105,5 +105,6 @@ class Solution:
```
{{< /terminal >}}

**Time**: O(N)
**Space**: O(N)
**Time**: $O(n)$

**Space**: $O(n)$
9 changes: 3 additions & 6 deletions content/posts/problems/basic-calculator.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ After traversing the string $s$, we return $ans$.
The time complexity is $O(n)$, and the space complexity is $O(n)$, where $n$ is the length of the string $s$.

#### Approach 1:
**The below can be used in Basic Calculator III**
The below can be used in [***Basic Calculator III***](https://samirpaulb.github.io/posts/basic-calculator-iii)

{{< terminal title="Python Code" >}}
{{< terminal title="Python Code: Approach 1" >}}
```python
import collections
class Solution:
Expand Down Expand Up @@ -114,10 +114,7 @@ class Solution:
```
{{< /terminal >}}

**Time**: O(N)
**Space**: O(N)

{{< terminal title="Python Code" >}}
{{< terminal title="Python Code: Stack approach" >}}
```python
class Solution:
def calculate(self, s: str) -> int:
Expand Down

0 comments on commit 456a21a

Please sign in to comment.