自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(431)
  • 收藏
  • 关注

原创 图论相关问题(提纲)

一、欧拉图(七桥问题)七桥问题:给定一个图,能否从某个顶点出发,不重复地遍历所有的边,并且回到起点。欧拉图:图G是欧拉图的充要条件是,G连通且没有奇定顶点。二、一笔画问题。一个图能一笔画成的充要条件是,图G连通且奇顶点数为0或2.一笔画算法参考:http://blog.csdn.net/jmspan/article/details/51279044三、哈密尔

2016-06-18 01:07:44 1216

原创 LeetCode 360. Sort Transformed Array(计算函数)

原题网址:https://leetcode.com/problems/sort-transformed-array/Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element 

2016-06-17 11:42:23 1248

原创 LeetCode 359. Logger Rate Limiter(日志漏桶)

原题网址:https://leetcode.com/problems/logger-rate-limiter/Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not p

2016-06-17 01:24:29 4046

原创 LeetCode 354. Russian Doll Envelopes(信封包装)

原题网址:https://leetcode.com/problems/russian-doll-envelopes/You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and on

2016-06-16 06:39:42 2563

原创 LeetCode 356. Line Reflection(线反射)

原题网址:https://leetcode.com/problems/line-reflection/Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given set of points.Example 1:Given po

2016-06-16 02:43:49 2088

原创 LeetCode 353. Design Snake Game(设计贪吃蛇游戏)

原题网址:https://leetcode.com/problems/design-snake-game/Design a Snake game that is played on a device with screen size = width x height. Play the game online if you are not familiar with the gam

2016-06-16 02:41:06 4812

原创 LeetCode 352. Data Stream as Disjoint Intervals(数据流区间)

原题网址:https://leetcode.com/problems/data-stream-as-disjoint-intervals/Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen so far as a list of dis

2016-06-16 01:11:36 1543

原创 LeetCode 355. Design Twitter(设计Twitter)

原题网址:https://leetcode.com/problems/design-twitter/Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in

2016-06-15 04:49:48 953

原创 LeetCode 358. Rearrange String k Distance Apart(字符间隔)

原题网址:https://leetcode.com/problems/rearrange-string-k-distance-apart/Given a non-empty string str and an integer k, rearrange the string such that the same characters are at least distance k fro

2016-06-15 03:27:55 4504

原创 LeetCode 357. Count Numbers with Unique Digits(计算无重复数字)

原题网址:https://leetcode.com/problems/count-numbers-with-unique-digits/Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n.Example:Given n = 2, return 91. (

2016-06-15 02:04:36 1354

原创 关于图的常用算法——Dijkstra单源最短路径、Floyd多源最短路径、Prim和Kruskal最小生成树算法

Dijkstra最短路径算法是计算某一点到其它点的最短距离的算法。Floyd算法是用来计算图中所有点之间的最短距离,可参考:http://developer.51cto.com/art/201403/433874.htm最小生成树(Minimium Spanning Tree)如果要在N个城市中铺设网络,每个城市之间的网络建设成本不同,如何找到一个建设方案,使得

2016-06-10 15:29:52 5100

原创 LeetCode 42. Trapping Rain Water

原题网址:https://leetcode.com/problems/trapping-rain-water/Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap aft

2016-06-09 02:22:13 751

原创 LeetCode 324. Wiggle Sort II(摇摆排序)

原题网址:https://leetcode.com/problems/wiggle-sort-ii/Given an unsorted array nums, reorder it such that nums[0] nums[2] .Example:(1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is

2016-06-05 00:58:45 1440

原创 LeetCode 124. Binary Tree Maximum Path Sum(二叉树最大路径和)

原题网址:https://leetcode.com/problems/binary-tree-maximum-path-sum/Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting

2016-05-27 00:27:32 2041

原创 LeetCode 125. Valid Palindrome(校验对称)

原题网址:https://leetcode.com/problems/valid-palindrome/Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan,

2016-05-27 00:27:03 447

原创 LeetCode 126. Word Ladder II(单词梯子)

原题网址:https://leetcode.com/problems/word-ladder-ii/Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, s

2016-05-27 00:26:42 868

原创 LeetCode 127. Word Ladder(单词梯子)

原题网址:https://leetcode.com/problems/word-ladder/Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWor

2016-05-27 00:26:28 1096

原创 LeetCode 128. Longest Consecutive Sequence(最长连续序列)

原题网址:https://leetcode.com/problems/longest-consecutive-sequence/Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4,

2016-05-27 00:26:15 818

原创 LeetCode 129. Sum Root to Leaf Numbers(节点求和)

原题网址:https://leetcode.com/problems/sum-root-to-leaf-numbers/Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-l

2016-05-27 00:26:01 497

原创 LeetCode 130. Surrounded Regions(包围区域)

原题网址:https://leetcode.com/problems/surrounded-regions/Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's i

2016-05-27 00:25:49 506

原创 LeetCode 131. Palindrome Partitioning(回文分区)

原题网址:https://leetcode.com/problems/palindrome-partitioning/Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitionin

2016-05-27 00:25:24 647

原创 LeetCode 133. Clone Graph(克隆图)

原题网址:https://leetcode.com/problems/clone-graph/Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes ar

2016-05-27 00:22:58 797

原创 LeetCode 132. Palindrome Partitioning II(回文切分)

原题网址:https://leetcode.com/problems/palindrome-partitioning-ii/Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a pa

2016-05-27 00:22:56 723

原创 LeetCode 134. Gas Station(加油站)

原题网址:https://leetcode.com/problems/gas-station/There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and i

2016-05-27 00:22:49 688

原创 LeetCode 135. Candy(糖果)

原题网址:https://leetcode.com/problems/candy/There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following re

2016-05-27 00:22:41 454

原创 LeetCode 136. Single Number(单个数字)

原题网址:https://leetcode.com/problems/single-number/Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runti

2016-05-27 00:22:39 388

原创 LeetCode 137. Single Number II(单个数字)

原题网址:https://leetcode.com/problems/single-number-ii/Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a lin

2016-05-27 00:22:35 620

原创 LeetCode 138. Copy List with Random Pointer(拷贝随机指针)

原题网址:https://leetcode.com/problems/copy-list-with-random-pointer/A linked list is given such that each node contains an additional random pointer which could point to any node in the list or nul

2016-05-27 00:22:32 497

原创 LeetCode 139. Word Break(单词分隔)

原题网址:https://leetcode.com/problems/word-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.

2016-05-27 00:22:29 801

原创 LeetCode 140. Word Break II(单词切分)

原题网址:https://leetcode.com/problems/word-break-ii/Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return al

2016-05-27 00:22:25 2871

原创 LeetCode 141. Linked List Cycle(链表循环)

原题网址:https://leetcode.com/problems/linked-list-cycle/Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?方法:使用两个指针。/** * Defini

2016-05-27 00:22:22 441

原创 LeetCode 142. Linked List Cycle II(循环链表)

原题网址:https://leetcode.com/problems/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.

2016-05-26 03:07:42 1073

原创 LeetCode 30. Substring with Concatenation of All Words(所有单词的连接)

原题网址:https://leetcode.com/problems/substring-with-concatenation-of-all-words/You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of

2016-05-26 02:21:59 403

原创 LeetCode 143. Reorder List(重组链表)

原题网址:https://leetcode.com/problems/reorder-list/Given a singly linked list L: 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' va

2016-05-26 02:08:26 1500

原创 LeetCode 144. Binary Tree Preorder Traversal(二叉树前缀遍历)

原题网址:https://leetcode.com/problems/binary-tree-preorder-traversal/Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1

2016-05-26 01:57:11 543

原创 LeetCode 145. Binary Tree Postorder Traversal(二叉树后序遍历)

原题网址:https://leetcode.com/problems/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

2016-05-26 01:31:28 499

原创 LeetCode 146. LRU Cache(LRU缓存)

原题网址:https://leetcode.com/problems/lru-cache/Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get

2016-05-26 01:24:27 816

原创 LeetCode 147. Insertion Sort List(插入有序链表)

原题网址:https://leetcode.com/problems/insertion-sort-list/Sort a linked list using insertion sort.方法:/** * Definition for singly-linked list. * public class ListNode { * int val; * Li

2016-05-26 01:20:22 735

原创 LeetCode 148. Sort List(链表排序)

原题网址:https://leetcode.com/problems/sort-list/Sort a linked list in O(n log n) time using constant space complexity.方法一:分区排序,以第一个元素为参照,分为大中小。/** * Definition for singly-linked list. * publi

2016-05-26 01:18:10 831

原创 LeetCode 149. Max Points on a Line(直线上的点)

原题网址:https://leetcode.com/problems/max-points-on-a-line/Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.方法一:逐点比较斜率。/** * Definition for a

2016-05-26 01:12:31 567

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

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