Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leetcode | Return result is always empty

Tags:

javascript

I'm going over some array problems on Leetcode and when I tried to submit my answer I got an empty result as my answer. I'm not sure why it's happing. I tried to run this function in Chrome DevTools and it works as expected. Any hints would be appreciated.

enter image description here

/**
 * @param {number[]} nums
 * @return {number}
 */
function removeDuplicates(nums) {
    return nums.filter((n, index) => nums[index] != nums[++index])
}

Link to the problem: https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/727/

like image 663
Anonymous Anonymous Avatar asked Mar 06 '26 01:03

Anonymous Anonymous


1 Answers

Ok this is strange because I went and even logged to the console.log my correct answer but the return is.. very strange.. so far it seems that this is not your fault

I even tried making the return be a string and it still shows this empty array.. it's strange FOR REAL

enter image description here

like image 186
The Bomb Squad Avatar answered Mar 07 '26 14:03

The Bomb Squad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!