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

107
Views
Why I am not getting complete array after concatenation of two arrays?

I am trying to solve Array question on leetcode Array Merge Sort and issue is that when I am running my code in online compiler i.e. JS Fiddle, Programiz, I can see the complete array after concatenation but when I am running same code on leetcode compiler getting only first array instead of complete array.

Can someone please advise where, I am facing the issue.

PFA of issue -

Leetcode Submission Report --> Here, I'm getting half array instead of complete array.

Online Compiler Output --> Here, I'm getting the complete array.

Below is my code for Leetcode Question -

var merge = function(nums1, m, nums2, n) {
    let x = nums1.length;
    if(x !== m){
        for(let i = x; i > m; i--){
            nums1.pop(nums1[i]);
        }
    }
    return nums1.concat(nums2).sort((a,b)=> a -b);
};
console.log(merge([1,2,3,0,0,0],3,[2,5,6],3));

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!