原文: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