原文:leetcode[167] Two Sum II - Input array is sorted

給定數組排好序了,然后給一個目標,找到兩個數相加等於目標的兩個數的下標。 蠻簡單感覺,就是左右兩邊往里,比目標大就右邊減,小就左邊加。一樣就輸出。 然后網上對照了一下: 他把else if 和else合成一句用 :三元表達式,值得更簡潔。挺好。 : 題,終於是刷了一遍了,趕上了leetcode出題的速度,從 看着漲到 ,估計以后陸續還會增加。刷了兩個多月。這算是我比較持之以恆做的一件事吧。每天都堅 ...

2014-12-27 23:38 4 2510 推薦指數:

查看詳情

Median of Two Sorted Array leetcode java

題目: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity ...

Wed Jul 23 08:45:00 CST 2014 1 9496
Search in Rotated Sorted Array II leetcode java

題目: Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write ...

Tue Jul 22 08:40:00 CST 2014 0 3075
[leetcode]Find Minimum in Rotated Sorted Array II @ Python

原題地址:https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/ 解題思路:這道題和上一道題的區別是,數組中可能有相同的數。那么,分下列幾種情況: 代碼: ...

Thu Oct 23 22:26:00 CST 2014 0 2263
[leetcode]Two Sum @ Python

原題地址:http://oj.leetcode.com/problems/two-sum/ 題意:找出數組numbers中的兩個數,它們的和為給定的一個數target,並返回這兩個數的索引,注意這里的索引不是數組下標,而是數組下標加1。比如numbers={2,7,11,17}; target ...

Tue Apr 29 20:43:00 CST 2014 0 23740
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM