- 博客(162)
- 收藏
- 关注
原创 LeetCode 080 Remove Duplicates from Sorted ArrayII
题目重复的可以出现最多两次代码public class Solution { public int remo
2015-04-06 22:40:40 384
原创 LeetCode 045 Jump Game II
题目Given an array of non-negative integers, you are initially positioned at the first index
2015-03-26 22:24:40 381
原创 LeetCode 031 Next Permutation
题目数组,按照递增,求下一组数组序列代码public class Solution { public void nextPermutation(int[
2015-03-25 15:47:09 354
原创 LeetCode 040 Combination SumII
题目给一个set 和 一个target 。set中元素只能用一次,加起来得到target的集合。代码
2015-03-24 22:31:56 384
原创 LeetCode 039 Combination Sum
题目给一个set 和 一个target 。set中元素可以任意数量,加起来得到target的集合。代码publi
2015-03-24 22:16:29 320
原创 LeetCode 005 Longest Palindromic Substring
题目字符串中最长回文子串代码public class Solution { public String longestPalindrome(String s) { if(s ==
2015-03-19 23:23:56 312
原创 LeetCode 008 String to Integer (atoi)
题目完成atoi 的函数。特别要考虑corner。代码public class Solution { public int atoi(String str) { if(st
2015-03-19 15:00:50 430
原创 LeetCode 023 Merge k Sorted Lists
题目把k个排序号的链表连接成一个有序链表。代码public class Solution { public ListNode mergeKLists(List lists) { i
2015-03-19 14:21:39 356
原创 LeetCode 017 Letter Combinations of a Phone Number
题目字符串按照zigzag排列,最后按照行输出结果。代码 public static List letterCombinations(String digits) { Li
2015-03-18 12:36:26 350
原创 LeetCode 006 ZigZag Conversion
题目字符串按照zigzag排列,最后按照行输出结果。代码public class Solution { public String convert(String s, int nRow
2015-03-16 15:33:26 325
原创 LeetCode 002 Add Two Numbers
题目两个数,每位都按照链表倒序存储。求和,存入新的链表中。代码public class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode
2015-03-15 10:17:13 349
原创 JAVA 与 Python 变量赋值的不同
具体例子如下:JAVAint l2Val = 0;int l1Val = 0;Pythonv1 = v2 = 0直观的感觉:Python 比 Java 简洁多了。原因:1 JAVA强类型,每个新变量都要定义属性;2 JAVA虽然可以连写,但是新定义属性的变量不能写在当中;3 Python 不需要定义属性,且可以连写。
2015-03-15 10:02:07 946
转载 编程之美--2.11 寻找最近点对
[cpp] view plaincopy/* 对于这类题目,首先要对进行划分区域,要划分区域就要按照X坐标进行排序,然后进行划分,当划分到只有两个点或者三个点时,在进行求点之间的距离,并记录! 接下来进来区域之间的合并,当当前的点到刚才以这个划分区域为准的中线距离大于刚才我们所求的距离时,则放弃,否则进行更新最短距离! 总体算法思想就是利用递归最后进行合
2014-10-13 15:03:20 779
原创 LeetCode 086 Partition List
题目Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
2014-09-02 08:09:41 510
原创 LeetCode 120 Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [
2014-08-19 15:22:30 464
原创 LeetCode 038 Count and Say
题目Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program sh
2014-08-19 08:52:53 613
原创 LeetCode 109 Convert Sorted List to Binary Search Tree
题目Write a function to find the longest common prefix string amongst an array of strings.
2014-08-18 12:28:56 685
原创 LeetCode 034 Search for a Range
题目Given a sorted array of integers, find the starting and ending position of a given target value.Your a
2014-08-18 11:39:52 429
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人