Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
¿Por qué este problema de leetcode (fácil) me marca mal?

Preparándome para una entrevista y practicando algo de LC. Haciendo esta pregunta:

https://leetcode.com/problems/move-zeroes/

Mi solución es la siguiente:

 //filter out 0s using filter and includes methods //check length differnece between initial and filtered array //difference = num of 0s. push this amount to end of initial array. //make new array with dif as size n then fill with 0s and add to initial with spread operator var moveZeroes = function(nums) { let zero = [0]; let initLength = nums.length; nums = nums.filter(num => !zero.includes(num)) let lengthDif = initLength - nums.length let zeroArr = new Array(lengthDif) zeroArr.fill(0) nums = [...nums,...zeroArr] };

El depurador muestra que nums tiene un valor correcto después de ejecutarse, pero LC dice que mi código es incorrecto. ¿Me estoy perdiendo algo aquí o LC solo tiene errores?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!