Skip to content

Commit 2b20aaa

Browse files
authored
Update 0503-Next-Greater-Element-||.md
1 parent 5e7bfbb commit 2b20aaa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

dsa-solutions/lc-solutions/0500-0599/0503-Next-Greater-Element-||.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ Output: [2,3,4,-1,4]
4242

4343
## Solution for Next Greater Element II
4444

45-
45+
<Tabs>
46+
<TabItem value="Brute Force" label="Brute Force">
4647
### Brute Force - Recursion
4748

4849
#### Intuition
@@ -61,9 +62,6 @@ The idea is to make use of an array doublearr which is formed by concatenating t
6162

6263
#### Brute Force Solution
6364

64-
<Tabs>
65-
<TabItem value="Brute Force" label="Brute Force">
66-
6765
#### Implementation
6866

6967
```
@@ -170,6 +168,8 @@ class Solution {
170168
- Additionally, the result vector to store the next greater element for each element in the input array also requires $O(N)$ space.
171169
Therefore, the overall space complexity is $O(N)$.
172170
171+
</TabItem>
172+
<TabItem value="Optimized Approach " label="Optimized Approach ">
173173
174174
### Optimized Approach
175175
#### Intuition
@@ -214,6 +214,9 @@ class Solution {
214214
- Time Complexity: $ O(N)$
215215
- Space Complexity: $ O(N)$
216216
217+
</TabItem>
218+
</Tabs>
219+
217220
## References
218221
219222
- **LeetCode Problem**: [Next Greater Element II](https://leetcode.com/problems/next-greater-element-ii/description/)

0 commit comments

Comments
 (0)