X-Received: by 2002:ac8:34c3:: with SMTP id x3mr4345787qtb.18.1553899250039; Fri, 29 Mar 2019 15:40:50 -0700 (PDT) X-Received: by 2002:a25:b448:: with SMTP id c8mr42397112ybg.269.1553899249564; Fri, 29 Mar 2019 15:40:49 -0700 (PDT) Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!t9no2206181qtn.0!news-out.google.com!i54ni1512qte.0!nntp.google.com!t9no2206175qtn.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.programmer Date: Fri, 29 Mar 2019 15:40:49 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=84.74.101.34; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r NNTP-Posting-Host: 84.74.101.34 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1738bf0a-0af9-4ff1-9c54-35d2b9fa0562@googlegroups.com> Subject: Re: Interview question - better solution for MergePurgeAndReverseOrder() From: bursejan@gmail.com Injection-Date: Fri, 29 Mar 2019 22:40:50 +0000 Content-Type: text/plain; charset="UTF-8" Lines: 137 Xref: csiph.com comp.lang.java.programmer:38835 The word "implement" got a total new meaning. Did they notice that you didn't implement anything, only used some library calls in the most complicated way. Basically if the two input vectors are already sorted, you would possibly implement something totally different. Namely a pairing algorithm, which reads as follows: public static int[] merge(int[] a, int[] b) { int[] res=new int[a.length+b.length]; int i=0; int j=0; int k=0; while (j