摘要: 题目: 给定一个数字三角形,找到从顶部到底部的最大路径和。每一步可以移动到下面一行的相邻数字上。输入第一行数字n是三角形的行数,接下来的n行是数字三角形的每一行,如: 5 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 输出是 30 思路:... 阅读全文
posted @ 2016-04-13 17:06 Jung_zhang 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 i... 阅读全文
posted @ 2016-04-12 19:14 Jung_zhang 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 th... 阅读全文
posted @ 2016-04-11 22:00 Jung_zhang 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 题目: 字典序问题,给定一个长度不超过6的小写字母升序字符串(字符串中的字符相对顺序和字母表中的顺序一致),迅速计算出在字典中的编码,字典如: 1 2 3 ... 26 27 28 ... a b c ... z ab ... 阅读全文
posted @ 2016-04-10 23:03 Jung_zhang 阅读(1352) 评论(0) 推荐(0) 编辑
摘要: 题目: Write a function to find the longest common prefix string amongst an array of strings. 题目大意: 写一个函数,求一个字符串数组中最长的公共前缀子串。 思路: 在做这道题之前先要了解一下... 阅读全文
posted @ 2016-04-10 14:21 Jung_zhang 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题目大意: 给定一个罗马数字,将其转化为一个整数。转化好的... 阅读全文
posted @ 2016-04-09 19:42 Jung_zhang 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题目大意: 输入一个整形数字,将其转化为罗马数字,范围在1... 阅读全文
posted @ 2016-04-09 15:49 Jung_zhang 阅读(168) 评论(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 t... 阅读全文
posted @ 2016-04-08 18:00 Jung_zhang 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目: , Implement regular expression matching with support for '.' and '*'. '.' Matches any single character.'*' Matches zero or more of the preced... 阅读全文
posted @ 2016-04-07 20:22 Jung_zhang 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 题目: Determine whether an integer is a palindrome. Do this without extra space. 题目大意: 判断一个数字是不是回文数,要求不是用额外的空间。 思路: 最近的几道LeetCode的题很简单,答题思路就是将原数... 阅读全文
posted @ 2016-04-05 22:02 Jung_zhang 阅读(111) 评论(0) 推荐(0) 编辑