2014年2月2日

摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.Input:(2 -> 4 -> 3) + (5 -> 6 -> 4)Output:7 -> 0 -> 8思路:乍一看以为是大整数,实则相当简单,比 阅读全文
posted @ 2014-02-02 15:56 小唯THU 阅读(225) 评论(0) 推荐(0) 编辑

2014年2月1日

摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama"is a palindrome."race a car"isnota palindrome.Note:Have you consider that the string might be empty? This is a good question to 阅读全文
posted @ 2014-02-01 18:00 小唯THU 阅读(197) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?思路:最简单的DP问题:递归+查表代码: 1 int climbStairs(int n) { 2 vector memo(n+1, -1);//忘了在memo[0]没有意义的时候,数组初始大小加一。。。 3 return climb(n, memo); ... 阅读全文
posted @ 2014-02-01 13:53 小唯THU 阅读(458) 评论(0) 推荐(0) 编辑
摘要: Given two sorted integer arrays A and B, merge B into A as one sorted array.Note: You may assume that A has enough space to hold additional elements from B. The number of elements initialized in A and B are m and n respectively.思路:归并的一部分,比Merge Two Sorted Lists还要简单代码: 1 void merge(int A[], int m, in 阅读全文
posted @ 2014-02-01 13:06 小唯THU 阅读(193) 评论(0) 推荐(0) 编辑

2014年1月26日

摘要: Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example,Given[0,1,0,2,1,0,1,3,2,1,2,1], return6.The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of 阅读全文
posted @ 2014-01-26 12:27 小唯THU 阅读(251) 评论(0) 推荐(0) 编辑

2014年1月11日

摘要: 开启windows 7的隐藏功能:虚拟WiFi和SoftAP(即虚拟无线AP),就可以让电脑变成无线路由器,实现共享上网,节省网费和路由器购买费。亲测通过,比conncetify方便,稳定,网速好! 以操作系统为win7的笔记本或装有无线网卡的台式机作为主机。主机设置如下: 1、以管理员身份运行命令提示符: “开始”---在搜索栏输入“cmd”----右键以“管理员身份运行” 2启用并设定虚拟W... 阅读全文
posted @ 2014-01-11 23:54 小唯THU 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 昨天遇到一个Python问题,今天好奇试了一下 >>> a = {1:23,'ab':56} >>> b = {2:22,'ab':57} >>> a > b False >>> a >> b = {1:22,'ab':57} >>> a > b True >>> a ycallx.__ne__(y),x>ycallsx.__gt__(y), andx>=ycallsx.__ge_... 阅读全文
posted @ 2014-01-11 14:01 小唯THU 阅读(1918) 评论(0) 推荐(0) 编辑
摘要: Mac篇 公司的机器内存只有8G,不想再大动干戈为了Windows Live Writer装个Vmware了,谷歌娘讲MarsEdit不错,那就试试用这个写个试用贴呗 就是这货了,果然是火星来的,从剪贴板贴图有点慢,竟然不能随意拖大小,图文并茂一直是我的目标啊受挫 不管了,竟然直接输入博客地址即可,WLW君真是麻烦多了 ╮(╯▽╰)╭果然没那么简单 这个Error似乎没有对我的博客生涯... 阅读全文
posted @ 2014-01-11 13:40 小唯THU 阅读(1773) 评论(14) 推荐(1) 编辑

2013年11月23日

摘要: 函数式编程 Lambda exec,eval和assert语句,repr函数 lambda语句 用来创建简短的单行匿名函数 print_assign = lambda name, value: name + '=' + str(value)等同于def print_assign(name, value): return name + '=' + str(value) la... 阅读全文
posted @ 2013-11-23 16:59 小唯THU 阅读(717) 评论(0) 推荐(0) 编辑
摘要: os模块 这个模块包含普遍的操作系统功能。 如果你希望你的程序能够与平台无关的话,这个模块是尤为重要的。一个例子就是使用os.sep可以取代操作系统特定的路径分割符。 os.system() 执行linux命令 >> os.system('ls -l') 也可以使用subprocess模块 >> subprocess.call('ls -l'.split()) os.getcwd... 阅读全文
posted @ 2013-11-23 10:38 小唯THU 阅读(600) 评论(0) 推荐(0) 编辑

导航