自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 [勇者闯LeetCode] 129. Sum Root to Leaf Number

[勇者闯LeetCode] 129. Sum Root to Leaf NumberDescription 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-

2017-07-03 22:59:03 206

原创 NP-完全问题的证明

NP-完全问题的证明问题 8.8 在精确的4SAT(EXACT 4SAT)问题中,输入为一组子句,每个子句都是恰好4个文字的析取,且每个变量最多在每个子句中出现一次。目标是求它的满足赋值——如果该赋值存在。证明精确的4SAT是NP-完全问题。证明已知3SAT属于NP-完全问题,所以可以通过将3SAT归约到EXACT 4SAT来证明EXACT 4SAT是NP-完全问题。对于任意一个3SAT实例,

2017-06-25 09:16:33 460

原创 [勇者闯LeetCode] 257. Binary Tree Paths

[勇者闯LeetCode] 257. Binary Tree PathsDescription Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \2 3 \ 5 All root-to-leaf pa

2017-06-24 22:22:53 206

原创 [勇者闯LeetCode] 191. Number of 1 Bits

[勇者闯LeetCode] 191. Number of 1 BitsDescription Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight). For example, the 32-b

2017-06-17 21:16:54 227

原创 [勇者闯LeetCode] 190. Reverse Bits

[勇者闯LeetCode] 169. Majority ElementDescription Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return

2017-06-10 10:09:54 246

原创 [勇者闯LeetCode] 189. Rotate Array

[勇者闯LeetCode] 189. Rotate ArrayDescription Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Info

2017-06-10 09:55:35 199

原创 [勇者闯LeetCode] 169. Majority Element

[勇者闯LeetCode] 169. Majority ElementDescription Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that

2017-06-03 23:09:16 349

原创 [勇者闯LeetCode] 167. Two Sum II - Input array is sorted

[勇者闯LeetCode] 167. Two Sum II - Input array is sortedDescription Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target numb

2017-06-03 22:27:21 226

原创 [勇者闯LeetCode] 160. Intersection of Two Linked Lists

[勇者闯LeetCode] 160. Intersection of Two Linked ListsDescription Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked l

2017-05-27 20:32:22 200

原创 [勇者闯LeetCode] 155. Min Stack

[勇者闯LeetCode] 155. Min StackeDescription Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) – Push element x onto stack. pop() – Remov

2017-05-27 19:56:27 215

原创 [勇者闯LeetCode] 142. Linked List Cycle II

[勇者闯LeetCode] 142. Linked List Cycle IIDescription Given a linked list, return the node where the cycle begins. If there is no cycle, return null.InformationTags: Linked List | Two PointersDifficu

2017-05-19 23:16:38 234

原创 [勇者闯LeetCode] 141. Linked List Cycle

[勇者闯LeetCode] 141. Linked List CycleDescription Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space?InformationTags: Linked List |

2017-05-19 22:48:39 200

原创 [勇者闯LeetCode] 136. Single Number

[勇者闯LeetCode] 136. Single NumberDescription Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime com

2017-05-13 22:40:29 330

原创 [勇者闯LeetCode] 125. Valid Palindrome

[勇者闯LeetCode] 125. Valid PalindromeDescription Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a can

2017-05-13 22:33:13 205

原创 [勇者闯LeetCode] 121. Best Time to Buy and Sell Stock

[勇者闯LeetCode] 121. Best Time to Buy and Sell StockDescription Say you have an array for which the ithi^{th} element is the price of a given stock on day ii. If you were only permitted to complet

2017-05-06 23:19:37 199

原创 [勇者闯LeetCode] 118. Pascal's Triangle

[勇者闯LeetCode] 118. Pascal’s TriangleDescription Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,

2017-04-29 21:11:03 203

原创 [勇者闯LeetCode] 112. Path Sum

[勇者闯LeetCode] 112. Path SumDescription Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For ex

2017-04-29 20:48:08 293

原创 [勇者闯LeetCode] 111. Minimum Depth of Binary Tree

[勇者闯LeetCode] 111. Minimum Depth of Binary TreeDescription Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down t

2017-04-29 20:35:12 236

原创 [勇者闯LeetCode] 110. Balanced Binary Tree

[勇者闯LeetCode] 110. Balanced Binary TreeDescription 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 t

2017-04-22 14:32:34 248

原创 [勇者闯LeetCode] 108. Convert Sorted Array to Binary Search Tree

[勇者闯LeetCode] 108. Convert Sorted Array to Binary Search TreeDescription Given an array where elements are sorted in ascending order, convert it to a height balanced BST.InformationTags: Tree | Dep

2017-04-22 14:13:01 209

原创 [勇者闯LeetCode] 107. Binary Tree Level Order Traversal II

[勇者闯LeetCode] 107. Binary Tree Level Order Traversal IIDescription Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from l

2017-04-15 09:24:13 177

原创 [勇者闯LeetCode] 104. Maximum Depth of Binary Tree

[勇者闯LeetCode] 104. Maximum Depth of Binary TreeDescription Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to

2017-04-09 15:51:48 171

原创 [勇者闯LeetCode] 101. Symmetric Tree

[勇者闯LeetCode] 101. Symmetric TreeDescription Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symme

2017-04-02 10:31:33 234

原创 [勇者闯LeetCode] 88. Merge Sorted Array

[勇者闯LeetCode] 88. Merge Sorted ArrayDescription Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: You may assume that nums1 has enough space (

2017-04-02 10:20:04 332

原创 [勇者闯LeetCode] 83. Remove Duplicates from Sorted List

[勇者闯LeetCode] 83. Remove Duplicates from Sorted ListDescription Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1

2017-04-02 10:13:18 325

原创 [勇者闯LeetCode] 70. Climbing Stairs

[勇者闯LeetCode] 70. Climbing StairsDescription You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you c

2017-03-26 15:36:21 403

原创 [勇者闯LeetCode] 66. Plus One

[勇者闯LeetCode] 66. Plus OneDescription Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero

2017-03-26 15:19:21 183

原创 [勇者闯LeetCode] 58. Length of Last Word

[勇者闯LeetCode] 58. Length of Last WordDescription Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string. If the last

2017-03-25 11:50:46 200

原创 [勇者闯LeetCode] 53. Maximum Subarray

[勇者闯LeetCode] 53. Maximum SubarrayDescription Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,

2017-03-25 11:47:10 326

原创 [勇者闯LeetCode] 11. Container With Most Water

[勇者闯LeetCode] 11. Container With Most WaterDescription Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e

2017-03-19 11:10:20 278

原创 [勇者闯LeetCode] 6. ZigZag Conversion

[勇者闯LeetCode] 6. ZigZag ConversionDescription The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for

2017-03-19 10:35:51 220

原创 [勇者闯LeetCode] 38. Count and Say

[勇者闯LeetCode] 38. Count and SayDescription The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is r

2017-03-19 09:55:06 214

原创 [勇者闯LeetCode] 35. Search Insert Position

[勇者闯LeetCode] 35. Search Insert PositionDescription Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in

2017-03-19 09:50:03 163

原创 [勇者闯LeetCode] 28. Implement strStr()

[勇者闯LeetCode] 28. Implement strStr()Description Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.InformationTags: Two

2017-03-19 09:41:01 343

原创 [勇者闯LeetCode] 27. Remove Element

[勇者闯LeetCode] 27. Remove ElementDescription Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you mu

2017-03-18 08:21:44 216

原创 [勇者闯LeetCode] 100. Same Tree

[勇者闯LeetCode] 100. Same TreeDescription Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and t

2017-03-12 15:38:33 319

原创 [勇者闯LeetCode] 26. Remove Duplicates from Sorted Array

[勇者闯LeetCode] 26. Remove Duplicates from Sorted ArrayDescription Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not al

2017-03-12 15:01:15 173

原创 [勇者闯LeetCode] 21. Merge Two Sorted Lists

[勇者闯LeetCode] 21. Merge Two Sorted ListsDescription Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Infor

2017-03-12 14:46:49 378

原创 [勇者闯LeetCode] 20. Valid Parentheses

[勇者闯LeetCode] 20. Valid ParenthesesDescription Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The brackets must close in the

2017-03-10 23:47:15 199

原创 [勇者闯LeetCode] 14. Longest Common Prefix

[勇者闯LeetCode] 14. Longest Common PrefixDescription Write a function to find the longest common prefix string amongst an array of strings.InformationTags: StringDifficulty: EasySolution列向扫描字符是否相同,

2017-03-10 23:28:44 225

空空如也

空空如也

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

TA关注的人

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