Re: [北美] Microsoft questions

看板Oversea_Job作者時間17年前 (2007/12/15 04:27), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/4 (看更多)
※ 引述《LINC (Go cubs!)》之銘言: : Given 2 sorted arrays, a[] and b[] : combine them with no extra array(or linear space). : e.g.: a[10] = [1, 3, 5, 7, 9] : b[3] = [2, 4, 6] : the result is a[] = [1, 2, 3, 4, 5, 6, 7, 9], assuming a[] has enough space. : Can anyone solve it? I don't see a good solution(meaning O(N)) yet. If "a[] has enough space" means a[] can store a + b, then right shift a by size(b), and take a[0] as the begining of storing new value. You are welcome to correct me if there is any error. ^^ -- ※ 發信站: 批踢踢參(ptt3.cc) ◆ From: 168.7.230.23
文章代碼(AID): #17OkSm00 (Oversea_Job)
文章代碼(AID): #17OkSm00 (Oversea_Job)