Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
rotating array causing time limit exception

I'm attempting a leetcode problem, rotate array, and the solution I'm trying is being accepted when I run the code but not when I submit it, despite the fact that this solution is being suggested online. Problem: https://leetcode.com/problems/rotate-array/

My solution:

var rotate = function(nums, k) {
  k = k % nums.length
  let count = 0
  while (count < k) {
    nums.unshift(nums.pop())
    count++
  }
}

Edit: Problem solved thanks to the comments!

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda