码迷,mamicode.com
首页 >  
搜索关键字:leetcode    ( 34993个结果
LeetCode——Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number...
分类:其他好文   时间:2014-04-30 00:21:32    阅读次数:536
[LeetCode] 4Sum
Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ...
分类:其他好文   时间:2014-04-29 22:40:00    阅读次数:438
[leetcode]Word Ladder II @ Python
[leetcode]Word Ladder II @ Python原题地址:http://oj.leetcode.com/problems/word-ladder-ii/参考文献:http://blog.csdn.net/doc_sgl/article/details/13341405 ht...
分类:编程语言   时间:2014-04-29 21:42:30    阅读次数:590
《Cracking the Coding Interview》——第17章:普通题——题目13
2014-04-29 00:15题目:将二叉搜索树展开成一个双向链表,要求这个链表仍是有序的,而且不能另外分配对象,就地完成。解法:Leetcode上也有,递归解法。代码: 1 // 17.13 Flatten a binary search tree into a doubly linked li...
分类:其他好文   时间:2014-04-29 14:51:49    阅读次数:460
从n个元素中选择k个的所有组合(包含重复元素)
LeetCode:Combinations这篇博客中给出了不包含重复元素求组合的5种解法。我们在这些解法的基础上修改以支持包含重复元素的情况。对于这种情况,首先肯定要对数组排序,以下不再强调修改算法1:按照求包含重复元素集合子集的方法LeetCode:Subsets II算法1的解释,我们知道:若当...
分类:其他好文   时间:2014-04-28 14:00:43    阅读次数:717
[LeetCode] 时间复杂度 O(n),空间复杂度 O(1) 的动态规划算法,题 Jump Game
Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yo...
分类:其他好文   时间:2014-04-28 11:30:27    阅读次数:551
[leetcode] Add Binary
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".给定两个二进制的字符串,返回他们的和。对于a,b两个二进制字符串,首先通过交换使a的长度小于b...
分类:其他好文   时间:2014-04-28 02:05:20    阅读次数:502
[Leetcode] ZigZag Conversion
The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font fo...
分类:其他好文   时间:2014-04-27 21:36:45    阅读次数:515
[Leetcode] 4Sum
Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ...
分类:其他好文   时间:2014-04-27 20:55:03    阅读次数:567
leetcode day4 -- Binary Tree Postorder(Preorder) Traversal && Edit Distance
?? 1、Binary Tree Postorder Traversal Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 retu...
分类:其他好文   时间:2014-04-27 18:58:59    阅读次数:481
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!