[Leetcode] Two Sum
摘要:
1. Sort :O(n*lgn)2. two points search from both ends to middle :O(n) 1 struct Node 2 { 3 int val; 4 int index; 5 Node(){} 6 Node(int v, int idx):val(v), index(idx){} 7 }; 8 9 bool compare(const Node &lhs, const Node &rhs)10 {11 return lhs.val < rhs.val;12 }13 14 cla... 阅读全文
posted @ 2013-03-02 16:49 龙豆 阅读(585) 评论(0) 推荐(0)
浙公网安备 33010602011771号