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

102
Views
Javascript, Given some conditionals, All posible combinations of arrays in an array

I have this array:

[[1, 3, 7][2, 1, 0][2, 5, 4][3, 5, 0][4, 2, 4][4, 5, 7][5, 3, 0][6, 3, 7]]

I want to have all possible combinations of arrays having two conditions:

  1. That the element 0 is never the same
  2. That the element 2 is different, without repetition

My product should be responsive to different inputs of 3 value arrays, and in this case, it should look like this:

[
[[1, 3, 7][2, 1, 0][4, 2, 4]]
[[1, 3, 7][2, 5, 4][3, 5, 0]]
[[1, 3, 7][2, 5, 4][5, 3, 0]]
[[1, 3, 7][3, 5, 0][4, 2, 4]]
... and so on
]

Hope you could understand the issue and give some help.

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!