class Solution { public: int listSize(ListNode* l){ if(l==NULL) return 0; int len=1; ListNode* p=l; while (p->next...
分类:
其他好文 时间:
2014-11-06 17:23:21
阅读次数:
163
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:
其他好文 时间:
2014-11-06 17:05:57
阅读次数:
134
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t...
分类:
其他好文 时间:
2014-11-06 16:46:53
阅读次数:
182
Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret...
分类:
其他好文 时间:
2014-11-06 16:36:48
阅读次数:
138
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:
其他好文 时间:
2014-11-06 16:36:09
阅读次数:
144
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:
其他好文 时间:
2014-11-06 16:34:26
阅读次数:
183
二分。情况讨论
class Solution {
public:
int findPos(int* p,int n,int x){
int low=0,high=n-1,mid;
while(low>1;
if(p[mid]<=x)low=mid...
分类:
其他好文 时间:
2014-11-06 00:47:00
阅读次数:
171
本人大三狗,大一学物理,大二转专业来了计院。一入计院深似海,从此节操是路人。转眼间一年过去了,基本上课本的知识学的很好,考前突击分数还很光鲜,但是总是觉得空虚。因为在这个讲究技术的年代,没有一点技术压身,是很容易睡不着觉的。近日阅读了不少前人的经验教训,感觉自己的目标很明确,应届入bat,有必要.....
分类:
其他好文 时间:
2014-11-05 19:20:20
阅读次数:
156
简单的算法题, Find Minimum in Rotated Sorted Array 的Python实现。题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6...
分类:
编程语言 时间:
2014-11-05 14:44:20
阅读次数:
222
题目:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ...
分类:
编程语言 时间:
2014-11-05 01:51:40
阅读次数:
224