posted @ 2016-10-19 21:38 徐岩 阅读(109) 评论(0) 推荐(0)
摘要:
方法一:(迭代) 方法二:(递归) 阅读全文
摘要:
方法一:(递归) 方法二: 阅读全文
posted @ 2016-10-19 21:33 徐岩 阅读(99) 评论(0) 推荐(0)
摘要:
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文
posted @ 2016-04-20 16:08 徐岩 阅读(110) 评论(0) 推荐(0)
摘要:
度度熊有一张网格纸,但是纸上有一些点过的点,每个点都在网格点上,若把网格看成一个坐标轴平行于网格线的坐标系的话,每个点可以用一对整数x,y来表示。度度熊必须沿着网格线画一个正方形,使所有点在正方形的内部或者边界。然后把这个正方形剪下来。问剪掉正方形的最小面积是多少。 Solution 2: 阅读全文
posted @ 2016-04-20 08:51 徐岩 阅读(212) 评论(0) 推荐(0)
摘要:
C市现在要转移一批罪犯到D市,C市有n名罪犯,按照入狱时间有顺序,另外每个罪犯有一个罪行值,值越大罪越重。现在为了方便管理,市长决定转移入狱时间连续的c名犯人,同时要求转移犯人的罪行值之和不超过t,问有多少种选择的方式? Solution 2: 阅读全文
posted @ 2016-04-20 08:20 徐岩 阅读(186) 评论(0) 推荐(0)
摘要:
Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + 阅读全文
posted @ 2016-04-12 16:34 徐岩 阅读(539) 评论(0) 推荐(0)
摘要:
Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do 阅读全文
posted @ 2016-04-12 14:53 徐岩 阅读(115) 评论(0) 推荐(0)
摘要:
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2016-04-12 14:51 徐岩 阅读(104) 评论(0) 推荐(0)
摘要:
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. Solution 1: 阅读全文
posted @ 2016-04-12 14:36 徐岩 阅读(102) 评论(0) 推荐(0)