排序:
默认
按更新时间
按访问量

leetcode 456. 132 Pattern

Given a sequence of n integers a1, a2, ..., an, a 132 pattern is a subsequence ai, aj, ak such that i < j < k and ai &l...

2018-06-03 14:58:19

阅读数:22

评论数:0

leetcode Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you ...

2018-05-26 09:17:45

阅读数:18

评论数:0

leetcode : Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST'...

2018-05-24 15:19:13

阅读数:9

评论数:0

LeetCode : Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and...

2018-05-23 19:14:43

阅读数:8

评论数:0

LeetCode : Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3...

2018-05-23 19:13:39

阅读数:8

评论数:0

leetcode : Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For ...

2018-05-23 19:12:38

阅读数:11

评论数:0

Lintcode Search a 2D Matrix

DescriptionWrite an efficient algorithm that searches for a value in an m x n matrix.This matrix has the following properties:Integers in each row ar...

2018-05-17 17:04:12

阅读数:20

评论数:0

求和问题总结(leetcode 2Sum, 3Sum, 4Sum, K Sum)

做过leetcode的人都知道, 里面有2sum, 3sum(closest), 4sum等问题, 这些也是面试里面经典的问题, 考察是否能够合理利用排序这个性质, 一步一步得到高效的算法. 经过总结, 本人觉得这些问题都可以使用一个通用的K sum求和问题加以概括消化, 这里我们先直接给出K S...

2018-05-16 21:41:09

阅读数:24

评论数:0

String to Integer

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below ...

2018-05-16 19:46:42

阅读数:13

评论数:0

最长公共子序列与最长公共子串(DP)

1. 问题描述子串应该比较好理解,至于什么是子序列,这里给出一个例子:有两个母串cnblogsbelong比如序列bo, bg, lg在母串cnblogs与belong中都出现过并且出现顺序与母串保持一致,我们将其称为公共子序列。最长公共子序列(Longest Common Subsequence...

2018-05-16 16:45:11

阅读数:36

评论数:0

LeetCode四道Permutations问题详解

LeetCode中与Permutations相关的共有四题:   31. Next Permutation   46. Permutations   47. Permutations II   60. Permutation Sequence   大致包括了所有全排列问题可能考到的题型。   本文...

2018-05-13 11:04:24

阅读数:31

评论数:0

Lintcode 127. Topological Sorting

Given an directed graph, a topological order of the graph nodes is defined as follow:For each directed edge A -> B in graph, A must before...

2018-05-12 22:48:59

阅读数:45

评论数:0

Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes' values.ExampleGiven: 1 / \ 2 3 / \ 4 5 return [1,2,4,5,3].class Solutio...

2018-04-01 18:25:49

阅读数:10

评论数:0

Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3...

2018-04-01 17:29:00

阅读数:13

评论数:0

Insert Node in a Binary Search Tree

Given a binary search tree and a new tree node, insert the node into the tree. You should keep the tree still be a valid binary search tree. Can you ...

2018-04-01 17:11:25

阅读数:25

评论数:0

Balanced Binary Tree

题目如下Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the ...

2018-04-01 16:40:20

阅读数:10

评论数:0

利用动态规划解决袋鼠过河问题

最近开始刷牛客上的题目,由于本科学的算法基本都忘了,因此写几个帖子记录下自己刷题学到的东西,正好复习一下算法了。 我们都知道,动态规划算法是算法设计中非常重要的一种方法,是一个多阶段决策的过程。在使用动态规划算法之前需要先判断问题是否满足优化原则,如果不满足优化原则是不能使用动态规划算法的。举个最...

2018-01-18 15:46:33

阅读数:810

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭