码迷,mamicode.com
首页 >  
搜索关键字:leetcode解题报告    ( 67个结果
LeetCode Convert Sorted List to Binary Search Tree 解题报告
从给定的有序链表生成一颗平衡二叉树。 解题思路:最容易想到的就是利用数组生成二叉树的方法,找到中间节点作为二叉树的root节点,然后分别对左右链表递归调用分别生成左子树和右子树。时间复杂度O(N*lgN)...
分类:其他好文   时间:2014-10-01 23:36:31    阅读次数:243
Leetcode Longest Valid Parentheses 结题报告
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is "()", which ...
分类:其他好文   时间:2014-09-22 03:21:11    阅读次数:264
Leetcode Construct Binary Tree from Preorder and Inorder Traversal
Construct Binary Tree from Preorder and Inorder Traversal 结题报告 从前序遍历和中序遍历的结果重建一颗二叉树。 解题思路,随便写一个二叉树,然后写出前序和中序遍历的结果会发现特点。 二叉树的首节点必然是前序遍历的第一个节点,以这个节点在中序遍历的结果中作为划分,这个节点左侧的是左子树的节点,右侧是右子树节点。 例如,一个二叉...
分类:其他好文   时间:2014-09-14 20:48:47    阅读次数:176
leetCode解题报告5道题(六)
题目一:Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, ...
分类:其他好文   时间:2014-07-22 23:04:12    阅读次数:246
LeetCode解题报告:Reorder List
Reorder ListGiven a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' val...
分类:其他好文   时间:2014-06-28 20:42:16    阅读次数:265
LeetCode解题报告:Linked List Cycle && Linked List Cycle II
Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Linked List Cycle IIGiven...
分类:其他好文   时间:2014-06-20 20:46:58    阅读次数:245
LeetCode解题报告:Binary Tree Postorder Traversal
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No...
分类:其他好文   时间:2014-06-18 17:32:02    阅读次数:168
LeetCode解题报告:Insertion Sort List
Insertion Sort ListSort a linked list using insertion sort. leetcode subject思路:标准的插入排序。考察一下链表的操作。对链表进行插入排序的正确方法是:新建一个头节点,遍历原来的链表,对原链表的每个节点找到新链表中适合插入位置...
分类:其他好文   时间:2014-06-16 00:34:07    阅读次数:364
LeetCode解题报告:LRU Cache
LRU CacheDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get...
分类:其他好文   时间:2014-06-14 23:54:37    阅读次数:352
[LeetCode]3Sum,解题报告
题目 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 the sum of zero. Note: Elements in a triplet (a,b,c) ...
分类:其他好文   时间:2014-06-14 12:45:13    阅读次数:209
67条   上一页 1 ... 4 5 6 7 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!