Skip to content

Commit 725c0ad

Browse files
committed
updated
1 parent a298ec6 commit 725c0ad

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

dsa-solutions/lc-solutions/0200-0299/0229-Majority-Element.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,17 @@ print(majorityElement(nums))
203203
</TabItem>
204204
</Tabs>
205205

206-
Complexity Analysis
206+
### Complexity Analysis
207207

208-
Time Complexity: O(N)
209-
Reason: We perform two passes through the array, each requiring linear time.
208+
### Time Complexity: O(N)
209+
**Reason:** We perform two passes through the array, each requiring linear time.
210210

211-
Space Complexity: O(1)
212-
Reason: We use a constant amount of extra space for counters and candidates.
211+
**Space Complexity:** O(1)
212+
**Reason:** We use a constant amount of extra space for counters and candidates.
213213

214214
This solution efficiently finds all elements that appear more than ⌊ n/3 ⌋ times using the Boyer-Moore Voting Algorithm. The time complexity is linear, and the space complexity is constant, making it suitable for large input sizes.
215215

216-
References
217-
LeetCode Problem: Majority Element II
218-
Authors GeeksforGeeks Profile: Vipul lakum
216+
#### References
217+
**LeetCode Problem:** Majority Element II
218+
**Authors GeeksforGeeks Profile:** Vipul lakum
219+
```

0 commit comments

Comments
 (0)