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

87
Views
Sé cómo hacerlo con un conjunto diferente de números pero no con estos

Me pidieron que hiciera un patrón como el siguiente:

11111
12221
12321
12221
11111

Mientras jugaba y lo averiguaba, solo podía hacer:

55555
54445
54345
54445
55555

Usando el código a continuación, quiero saber si puedo usar el mismo marco y cambiar variables y demás para obtener el resultado deseado. (Nota: el código debe usar bucles for anidados)

 function m(c){ var maxi=0 for(var i =0; i<c.length; i++){ if(maxi<c[i]){ maxi=c[i] } } return(maxi) } var n = 5 for(var i = 0; i<n; i++){ var a = '' for(var j = 0; j<n; j++){ a+= String(m([i+1,j+1, ni,nj])) } console.log(a) }
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!