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

315
Vistas
Generate array of fixed length combinations incrementing by n (Javascript Permutation)

I'm researching permutations and combinations and attempting to generate an array of sub arrays which have a fixed length and increment to every possible combination using Javascript.

For example:

arrayMaxLength = 4
incrementToMax = 2
incremental = 0.25

Generate:

[0,0,0,0], [0.25,0,0,0], [0.25,0.25,0,0], ..., [2,2,2,1.25], [2,2,2,1.50], [2,2,2,1.75], [2,2,2,2] ]

I've tried using the "heap data structure" (https://www.geeksforgeeks.org/heap-data-structure/) but I've not been able to generate repeating numbers like 1,1,1,1 with or other combinations like 1,2,2,1.

Are there any suggestions on how to accomplish this?

about 4 years ago · Juan Pablo Isaza
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