From 456a21a8afbd941fadcf47541252245998e77021 Mon Sep 17 00:00:00 2001 From: SamirPaulb <77569653+SamirPaulb@users.noreply.github.com> Date: Sun, 19 May 2024 22:28:05 +0530 Subject: [PATCH] -- --- content/posts/problems/basic-calculator-iii.md | 11 ++++++----- content/posts/problems/basic-calculator.md | 9 +++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/content/posts/problems/basic-calculator-iii.md b/content/posts/problems/basic-calculator-iii.md index 713832ece..c337349ea 100644 --- a/content/posts/problems/basic-calculator-iii.md +++ b/content/posts/problems/basic-calculator-iii.md @@ -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 @@ -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 @@ -105,5 +105,6 @@ class Solution: ``` {{< /terminal >}} -**Time**: O(N) -**Space**: O(N) \ No newline at end of file +**Time**: $O(n)$ + +**Space**: $O(n)$ \ No newline at end of file diff --git a/content/posts/problems/basic-calculator.md b/content/posts/problems/basic-calculator.md index 93bd70e63..189fe2b87 100644 --- a/content/posts/problems/basic-calculator.md +++ b/content/posts/problems/basic-calculator.md @@ -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: @@ -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: