原文:[LeetCode] Intersection of Two Arrays 兩個數組相交

Given two arrays, write a function to compute their intersection. Example:Givennums , , , ,nums , , return . Note: Each element in the result must be unique. The result can be in any order. 這道題讓我們找兩個 ...

2016-05-18 23:33 4 21085 推薦指數:

查看詳情

LeetCode:4_Median of Two Sorted Arrays | 求兩個排序數組的中位數 | Hard

題目: 解題思路:   我自己想的方法,先排序在查找。兩個數組,首先想到是歸並排序,然后再查找兩個數組合並之后的中間元素即為中位數。我們分析下時間復雜度主要用在了歸並排序上,為O((m+n)log(m+n)),顯然不符合題目要求。題目要求是O(log(m+n ...

Mon Dec 28 20:24:00 CST 2015 1 2967
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM