码迷,mamicode.com
首页 >  
搜索关键字:leetcode    ( 34993个结果
【leetcode】Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe...
分类:其他好文   时间:2014-07-22 23:16:35    阅读次数:373
[Leetcode] Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:其他好文   时间:2014-07-22 23:16:14    阅读次数:408
[leetcode] Anagrams
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.输入一个字符串数组,返回所有回文构词法(anagrams)的字符串,所谓回...
分类:其他好文   时间:2014-07-22 23:15:54    阅读次数:440
LeetCode:Reverse Words in a String
Reverse Words in a String题目链接:http://oj.leetcode.com/problems/reverse-words-in-a-string/ Given an input string, reverse the string word by word. F...
分类:其他好文   时间:2014-07-22 23:13:32    阅读次数:309
【leetcode刷题笔记】Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:其他好文   时间:2014-07-22 23:12:13    阅读次数:426
[leetcode]Insertion Sort List @ Python
原题地址:http://oj.leetcode.com/problems/insertion-sort-list/题意:对链表进行插入排序。解题思路:首先来对插入排序有一个直观的认识,来自维基百科。 代码循环部分图示:代码:class Solution:# @p...
分类:编程语言   时间:2014-07-22 23:11:32    阅读次数:411
Leetcode:Container With Most Water
戳我去解题Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoint...
分类:其他好文   时间:2014-07-22 23:09:34    阅读次数:337
LeetCode OJ - Word Ladder
我觉得这道题比较难,主要是因为对于我来说:1. 我没有把这个问题联想到树的宽度遍历(即便没有考虑树的宽度遍历,也是可以做的,但是我一开始实现的代码却是深度遍历,后来发现树的BFS一般使用queue实现的,貌似没有递归的方法??)2. 即使在意识到用BFS,却还有一个陷阱:我是对字典进行了BFS,这个...
分类:其他好文   时间:2014-07-22 23:08:55    阅读次数:305
Leetcode | Work Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For e...
分类:其他好文   时间:2014-07-22 23:08:32    阅读次数:383
[leetcode]Binary Tree Maximum Path Sum
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:其他好文   时间:2014-07-22 23:07:34    阅读次数:312
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!