摘要: Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements in a quadruplet (a,b,c,d) must be in non-descending order. (ie,a≤b≤c≤d)The solution set must 阅读全文
posted @ 2013-01-18 10:19 西施豆腐渣 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Given am xn matrix, if an element is 0, set its entire row and column to 0. Do it in place.uncompletedclass Solution {public: void setZeroes(vector<vector<int> > &matrix) { // Start typing your C/C++ solution below // DO NOT write int main() function if( matrix.size() == 0 ) return; 阅读全文
posted @ 2013-01-18 09:36 西施豆腐渣 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Here are few examples.[1,3,5,6], 5 → 2[1,3,5,6], 2 → 1[1,3,5,6], 7 → 4[1,3,5,6], 0 → 0class Solution { p 阅读全文
posted @ 2013-01-18 07:48 西施豆腐渣 阅读(198) 评论(0) 推荐(0) 编辑