自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Elimination Game

There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.Repeat the previous step

2016-12-12 16:54:11 251

原创 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 node to any node in the tree along the parent-child connections. Th

2016-12-03 17:00:59 265

原创 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-leaf path 1->2->3 which represents the number123.Find the total

2016-12-03 16:16:00 198

原创 Ugly Number II

Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example,1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first

2016-11-28 16:01:43 182

原创 Minimum Height Trees

For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees, those with minimum height are called

2016-11-21 19:03:09 215

原创 Populating Next Right Pointers in Each Node

Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node.

2016-11-21 18:35:39 253

原创 证明最大公共子图问题是NP完全问题

最大公共子图问题是给定两个图,要求去掉一些点后,两个图都得到一个节点数至少为b的子图,且两个子图完全相同。首先假设最大公共子图存在且给出了子图的顶点是哪几个,那么可以在多项式时间内检验出这个解是否正确,所以最大公共子图问题是NP问题,接下来只需要证明它是NP难的,就可以证明它是NP完全问题。我们已经知道求图的具有b个顶点的独立集的问题是一个NP完全问题,只要我们可以从求独立集的问题规约到求

2016-11-20 17:29:28 1691

原创 Remove K Digits

Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note:The length of num is less than 10002 and w

2016-11-07 19:13:17 305

原创 Dungeon Game

The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially

2016-10-31 16:32:22 283

原创 Best Time to Buy and Sell Stock III

Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You may

2016-10-24 15:35:25 155

原创 Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy

2016-10-24 15:27:21 237

原创 Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stoc

2016-10-24 14:54:05 168

原创 Frog Jump

A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.Given a list

2016-10-17 11:02:07 212

原创 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 after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,

2016-10-10 18:41:14 169

原创 Longest Increasing Path in a Matrix

Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outsi

2016-09-26 11:32:59 161

原创 Decode String

Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactlyk times. Note that k i

2016-09-25 19:50:40 360

原创 Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1:nums1 =

2016-09-12 16:23:11 428

原创 Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return

2016-09-12 09:52:58 184

原创 Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers

2016-09-05 10:19:38 154

原创 Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of

2016-09-05 09:58:13 178

原创 Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2. Note:Your algorithm should

2016-09-03 14:52:28 175

原创 Find the Difference

Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that wa

2016-09-03 10:52:11 187

空空如也

空空如也

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

TA关注的人

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