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

207
Views
Operador coalescente nulo en recursividad

Estaba tratando de convertir un árbol binario en una matriz y estoy confundido. Este es el código que estoy escribiendo:

 var maxDepth = function(root) { var rc=rc??[]; if(root==null) return ; rc.push(root.val); maxDepth(root.left); maxDepth(root.right); return ((rc.length-1)/2)+1; };

Entonces, el problema es que mi matriz siempre contiene 1 elemento. Pero según tengo entendido, después de presionar el primer elemento en rc, ¿el operador de fusión nulo no asignará el valor de rc a la matriz? ¿Por qué esencialmente restablece la matriz?

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!