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

245
Views
Hackerrank Challenge: la carrera de obstáculos. ¿Qué estoy haciendo mal?

así que estoy trabajando en un HarckerRank Challenge llamado "The Hurdle Race". Tengo dos formas de completar el desafío en mi IDE, pero solo pasa dos casos de prueba cuando lo coloco en el IDE en HackerRank. Cuando tomo una de las pruebas de casos y la pongo en mi propio IDE, obtengo el resultado correcto. ¿Me estoy perdiendo de algo? ¿Mi código es incorrecto? Abajo están mis códigos. ingrese la descripción de la imagen aquí

 // 1st: function hurdleRace(k, height) { let maxH = Math.max.apply(null, k); let iGotTheHops = 0; console.log(maxH); if (height < maxH) { console.log(maxH - height); return maxH - height; } else { console.log(0); return iGotTheHops; } } // 2nd: function hurdleRace2(k, height) { // Write your code here let maxHight = k[0]; let iGotHops = 0; for (let i = 0; i < k.length; i++) { if (k[i] > maxHight) { maxHight = k[i]; } } if (height < maxHight) { console.log(maxHight - height); return maxHight - height; } else { console.log(iGotHops); return iGotHops; } } hurdleRace([1,6,3,5,2],4) hurdleRace2([1,6,3,5,2],4)

Esta es la prueba que marca como incorrecta. Indica que mi retorno es 0.

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!