There are many solutions to an easy problem.
Problem
Java
sorting
1 | import java.util.*; |
Submission Detail
- 46 / 46 test cases passed.
- Runtime: 1 ms, faster than 99.67% of Java online submissions for Majority Element.
- Memory Usage: 42.9 MB, less than 72.59% of Java online submissions for Majority Element.
brute force
1 | class Solution { |
Submission Detail
- 46 / 46 test cases passed.
- Your runtime beats 37.72 % of java submissions.
- Your memory usage beats 14.52 % of java submissions.
Boyer-Moore Voting Algorithm
© Approach 6: Boyer-Moore Voting Algorithm
1 | class Solution { |
Submission Detail
- 46 / 46 test cases passed.
- Runtime: 1 ms, faster than 99.67% of Java online submissions for Majority Element.
- Memory Usage: 42.2 MB, less than 99.93% of Java online submissions for Majority Element.