Your Submissions
You haven't submitted any code for this challenge yet. Solve the problem by passing all the test cases, and your submissions will appear here.
xxxxxxxxxx
42
var assert = require('assert');
/**
* @param {number[]} nums
* @return {number}
*/
function majorityElement(nums) {
return nums;
}
try {
assertIsFunction(majorityElement, '`majorityElement` is a function');
console.log('PASSED: ' + '`majorityElement` is a function');
} catch (err) {
console.log(err);
}
try {
assert.equal(majorityElement([1, 4, 2, 4, 4, 3, 4]), 4);
console.log(
'PASSED: ' + '`majorityElement([1, 4, 2, 4, 4, 3, 4])` should return `4`'
);
} catch (err) {
console.log(err);
}
OUTPUT
Results will appear here.