10 2014 档案

为什么要读数学书
摘要:最近买了很多数学方面的书,从《天才引导的历程》,《什么是数学》到《费马大定理》,《黎曼猜想漫谈》。基本上是科普性质,但也需要一定的数学知识和耐心才能读进去。 数学跟我的工作没有太多的联系,只是为了探求智力上的极限,似乎这慢慢成为我娱乐的一种方式。在思考当中我找不到比数学问题更能考验纯粹思维能力的东西了。 在数学家的世界里,用几个月甚至数年的时光去搞明白一些问题好像是很平常的事情。即使是具... 阅读全文

posted @ 2014-10-30 20:05 openqt 阅读(263) 评论(0) 推荐(0)

Encode Adjacent Letters
摘要:Encode a string by counting the consecutive letter. (i.e., "aaaabbxxxyyz" might become "a4b2x3y2z1"). 分析: 这个问题是一个基本的数据压缩算法,将相邻的字符计数存储。解法没有什么特别需要注意的地方,按部就班的实现代码就可以了。 class Solution: # @param s,... 阅读全文

posted @ 2014-10-21 17:18 openqt 阅读(177) 评论(0) 推荐(0)

Find Minimum in Rotated Sorted Array II
摘要:Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose a sorted array is rotated at some pivot unknown ... 阅读全文

posted @ 2014-10-21 16:51 openqt 阅读(268) 评论(1) 推荐(0)

String to Integer (atoi)
摘要:Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cas... 阅读全文

posted @ 2014-10-21 01:16 openqt 阅读(153) 评论(0) 推荐(0)

3Sum Closest
摘要:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactl... 阅读全文

posted @ 2014-10-21 00:29 openqt 阅读(219) 评论(0) 推荐(0)

4Sum
摘要:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a... 阅读全文

posted @ 2014-10-20 23:32 openqt 阅读(209) 评论(0) 推荐(0)

3Sum
摘要:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must... 阅读全文

posted @ 2014-10-20 21:09 openqt 阅读(254) 评论(0) 推荐(0)

Two Sum
摘要:Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe... 阅读全文

posted @ 2014-10-18 23:28 openqt 阅读(257) 评论(0) 推荐(0)

Longest Common Prefix
摘要:Write a function to find the longest common prefix string amongst an array of strings. 分析: 对一组字符串找到最长公共前缀。 因为只是找前缀所以可以以第一个字符串为基础,按个字符与其它字符串比较,直到有字符串已经遍历完或者碰到不一致的字符,返回到当前为止第一个字符串的前缀即可。 class Solution... 阅读全文

posted @ 2014-10-18 21:16 openqt 阅读(185) 评论(0) 推荐(0)

Find Minimum in Rotated Sorted Array
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. You may assume no duplicate exists in the arr... 阅读全文

posted @ 2014-10-18 19:52 openqt 阅读(257) 评论(0) 推荐(0)

魔王与西蒙•弗拉格
摘要:读《费马大定理》这本书的时候,第二章一开始引用了一段文字,出自阿瑟•波格斯(Arthur Porges)的《魔王与西蒙•弗拉格》“你听我说,”魔王吐露说,“就连其它星球上最出色的数学家——远远超出你们——也没能解开这个谜!嗨,土星上有个家伙——他看上去像是踩着高跷的蘑菇——能用心算解偏微分方程,就连... 阅读全文

posted @ 2014-10-17 23:46 openqt 阅读(845) 评论(0) 推荐(0)

导航