#include
#include
using namespace std;
/**
* return:
* -1:can not find;
* positive:find the first position;
*/
int findPosition(vector v,int size, int requestHalfSum){
int sum=0;
for(int i=...
分类:
其他好文 时间:
2015-07-19 20:13:58
阅读次数:
111
常见问题1、sudo gem install cocoapods 如下所示报错ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from https://rub...
分类:
其他好文 时间:
2015-07-19 20:09:51
阅读次数:
529
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a...
分类:
其他好文 时间:
2015-07-19 20:03:04
阅读次数:
99
一、简介 二、使用 三、常见问题 1、cgdb中文乱码问题,解决方法: 参考:http://blog.liyiwei.cn/fix-linuxmint-cgdb-chinese-charactor/ 步骤如下: find / -name "libncursesw.so*" rm -rf libncu...
分类:
数据库 时间:
2015-07-19 20:00:17
阅读次数:
162
This problem is more or less the same asFind Minimum in Rotated Sorted Array. And one key difference is as stated in the solution tag. That is, due to...
分类:
其他好文 时间:
2015-07-19 19:25:03
阅读次数:
97
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BAN...
Q: Given an array of size n, find the majority element. The majority element is the element that appears more than ?n/2? times. You may assume that th...
分类:
其他好文 时间:
2015-07-19 17:54:49
阅读次数:
111
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:What if the BST is modifi...
分类:
其他好文 时间:
2015-07-19 16:32:18
阅读次数:
137
As explained in the Solution tag, the key to solving this problem is to use invariants. We set two pointers:lfor the left andrfor the right. One key i...
分类:
其他好文 时间:
2015-07-19 16:23:24
阅读次数:
94
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...
分类:
其他好文 时间:
2015-07-19 16:21:34
阅读次数:
79