自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 资源 (1)
  • 收藏
  • 关注

原创 组合问题:全组合和C(n,m)

问题: 1.数组a[1~n],生成数组中所有元素的组合。 2.生成C(n,m)组合问题一:全组合思想: 数组长度为4,用4位2进制:0000~1111,二进制位为1表示选取该位元素,0表示不选。 代码://nums数组长度为n,mask为n位二进制掩码,二进制位为0,则选取该对应元素vector<int> getCombByMask(vector<int> nums,int mask,int

2015-09-29 23:35:50 792

原创 全排列问题:序号与排列转换

问题:全排列按字典序排序,每个排列都对应有一个序号。1.根据序号求排列;2.根据排列求序号。思想:n的阶乘的进制思想,从前往后一次是n!, (n-1)!, …, 2!, 1!。代码:1.根据排列求序号//一个排列在字典序全排列中的序号,输入:一个排列,输出:排列的序号int perm2num(vector<int> p){ int n=p.size(); int num=0;

2015-09-29 17:35:54 2234

原创 全排列生成算法

问题:生成1~n的全排列(生成一个数组中所有元素的全排列)。方法一:字典序方法思想:依据字典序顺序,由前一个排列,生成后一个排列。 代码://字典序方法:输入前一个排列,输出后一个排列vector<int> &nextPermutation(vector<int> &p){ unsigned long left,right; left=right=p.size()-1; w

2015-09-29 17:28:49 454

原创 网易163邮箱配置-iOS、OS X邮箱客户端

最近处于找工作阶段,收邮件比较头疼,我用了foxmail邮箱和163邮箱,想用一个客户端收邮件。我个人常用foxmail,但是像应聘360和网易等还是用163的邮箱比较好。本人是轻度强迫症患者:想让自己的MacBook Pro和iPhone 6s的邮件客户端能同时连接上foxmail和163,这样收发邮件就很方便。不想用网易的邮箱大师客户端,还有一个原因是邮箱大师没有mac版。连接foxmail比较

2015-09-26 14:24:40 27955

原创 leetcode 3 Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For “

2015-09-22 19:08:43 362

原创 leetcode 152 Maximum Product Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest produ

2015-09-22 18:17:32 373

原创 leetcode 53 Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2,1] has the

2015-09-22 16:51:17 279

原创 不小于N的素数个数

不小于N的素数个数使用eratosthenes algorithm算法。 算法思想:从2~n遍历,过滤到素数的倍数,没有被过滤的就是素数。//eratosthenes algorithmint countPrimes(int n) { //使用0和1两种状态就OK vector<int> vn(n,1); int count=0; for(int i=2;i<n;

2015-09-18 22:55:13 863

原创 leetcode 220 Contains Duplicate III

Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i and j is

2015-09-14 19:43:12 330

原创 leetcode 76 Minimum Window Substring

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 “BANC”.Note:

2015-09-14 19:38:21 357

转载 硬币面值组合问题

问题描述  假设我们有8种不同面值的硬币{1,2,5,10,20,50,100,200},用这些硬币组合够成一个给定的数值n。例如n=200,那么一种可能的组合方式为 200 = 3 * 1 + 1*2 + 1*5 + 2*20 + 1 * 50 + 1 * 100. 问总过有多少种可能的组合方式? (这道题目来自著名编程网站ProjectEuler, 点击这里查看原题目) 类似的题目还有:

2015-09-14 18:03:07 1298

原创 23种设计模式彩图-设计模式之禅

《The Zen of Design Patterns》 —《设计模式之禅》 书中的23种设计模式彩图:

2015-09-12 22:05:33 5038 1

cos-xml-auth

腾讯云cos签名算法实现及测试demo。 https://qcloud.com/document/product/436/7778

2017-04-27

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除