File tree Expand file tree Collapse file tree 1 file changed +0
-37
lines changed
Expand file tree Collapse file tree 1 file changed +0
-37
lines changed Original file line number Diff line number Diff line change @@ -42,43 +42,6 @@ Output: 2
4242Javascript Code:
4343
4444``` js
45- /*
46- * @lc app=leetcode id=169 lang=javascript
47- *
48- * [169] Majority Element
49- *
50- * https://leetcode.com/problems/majority-element/description/
51- *
52- * algorithms
53- * Easy (51.62%)
54- * Total Accepted: 365.6K
55- * Total Submissions: 702.5K
56- * Testcase Example: '[3,2,3]'
57- *
58- * Given an array of size n, find the majority element. The majority element is
59- * the element that appears more than ⌊ n/2 ⌋ times.
60- *
61- * You may assume that the array is non-empty and the majority element always
62- * exist in the array.
63- *
64- * Example 1:
65- *
66- *
67- * Input: [3,2,3]
68- * Output: 3
69- *
70- * Example 2:
71- *
72- *
73- * Input: [2,2,1,1,1,2,2]
74- * Output: 2
75- *
76- *
77- */
78- /**
79- * @param {number[]} nums
80- * @return {number}
81- */
8245var majorityElement = function (nums ) {
8346 let count = 1 ;
8447 let majority = nums[0 ];
You can’t perform that action at this time.
0 commit comments