08 2016 档案

摘要:class Solution {private: vector c; vector > res; //保存最后结果public: vector > combinationSum(vector &candidates, int target) { vector a;... 阅读全文
posted @ 2016-08-31 15:15 牧羊少年10号 阅读(80) 评论(0) 推荐(0) 编辑
摘要:什么是回溯法?回溯法的通用框架利用回溯法解决问题问题1:求一个集合的所有子集问题2:输出不重复数字的全排列问题3:求解数独——剪枝的示范问题4:给定字符串,生成其字母的全排列问题5:求一个n元集合的k元子集问题6:电话号码生成字符串问题7:一摞烙饼的排序问题8:8皇后... 阅读全文
posted @ 2016-08-31 11:37 牧羊少年10号 阅读(218) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: int searchInsert(vector& nums, int target) { int left = 0, right = nums.size(), mid = 0; while (lefttarget){... 阅读全文
posted @ 2016-08-30 20:16 牧羊少年10号 阅读(84) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: vector searchRange(vector& nums, int target) { vector result; int tmp = 0; int left = 0, right = nums.size(... 阅读全文
posted @ 2016-08-30 19:54 牧羊少年10号 阅读(96) 评论(0) 推荐(0) 编辑
摘要:class Solution{ public: int search(vector& nums,int target){ int first=0,end=nums.size(); int mid=0; while(first=nums[first]){ i... 阅读全文
posted @ 2016-08-30 16:53 牧羊少年10号 阅读(67) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: vector > permute(vector &num) { vector > result; int n=num.size(); if(n==1) { res... 阅读全文
posted @ 2016-08-30 11:34 牧羊少年10号 阅读(107) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: vector> permute(vector& nums) { vector> result; sort(nums.begin(), nums.end()); do{ result.push_back(nums... 阅读全文
posted @ 2016-08-30 11:09 牧羊少年10号 阅读(103) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: void nextPermutation(vector &num) { int n = num.size(); if (n == 1)return; for (int i = n - 2, ii = n - 1; ... 阅读全文
posted @ 2016-08-30 08:56 牧羊少年10号 阅读(71) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector > fourSum(vector &num,int target) { int n = num.size(); sort(num... 阅读全文
posted @ 2016-08-29 16:03 牧羊少年10号 阅读(97) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: int threeSumClosest(vector& nums, int target) { int result = nums[0] + nums[1] + nums[2]; int gap = abs(resu... 阅读全文
posted @ 2016-08-29 15:46 牧羊少年10号 阅读(63) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector > threeSum(vector &num) { int n = num.size(); sort(num.begin(), num.end()); ... 阅读全文
posted @ 2016-08-29 11:16 牧羊少年10号 阅读(138) 评论(0) 推荐(0) 编辑
摘要:bool compare(pair lh, pair rh){ return lh.first twoSum(vector &numbers, int target) { vector > num; int index = 1; for(vec... 阅读全文
posted @ 2016-08-29 09:45 牧羊少年10号 阅读(210) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*-import urllib2,cookielibimport urllibimport cStringIOimport datetimefrom PIL import Imagefrom lxml import etree... 阅读全文
posted @ 2016-08-12 16:21 牧羊少年10号 阅读(145) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/python# -*- coding: utf-8 -*-"""ZetCode Tkinter tutorialIn this script, we use the Labelwidget to show an image.Author: Jan... 阅读全文
posted @ 2016-08-12 16:21 牧羊少年10号 阅读(132) 评论(0) 推荐(0) 编辑
摘要:如果要在python2的py文件里面写中文,则必须要添加一行声明文件编码的注释,否则python2会默认使用ASCII编码。[python] view plain copy# -*- coding:utf-8 -*- 阅读全文
posted @ 2016-08-10 13:33 牧羊少年10号 阅读(215) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示