自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

My Blog

长路漫漫

  • 博客(32)
  • 收藏
  • 关注

原创 欢迎访问我的个人网站

代码拯救世界Welcome to My Blog!博客地址:Talk is cheap. Show me the codeGithub: https://github.com/linjiafengyangDebug myself and debug the world!

2017-12-16 21:35:41 583

原创 《算法概论》课后习题8.22——NP-完全问题

8.22 在任务调度中,常常会用到图。其中节点对应于任务,任务i到j的有向边表示i到j的先期条件。这样的图描述了调度问题中的任务先后关系(约束)。显然,一个调度是可行的当且仅当该图无环;如果调度不可行,我们需要求使其无环所需的最小约束数量。 给定有向图G=(V, E),子集E’⊆E称为一个反馈弧集合是指:将其移除后将使得G无环。 反馈弧集合(FEEDBACK ARC SET,简称FAS)问题:给

2017-12-31 11:31:53 1122

原创 LeetCode 198. House Robber

LeetCode 198. House RobberDescription: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from rob

2017-12-25 19:31:05 148

原创 LeetCode 746. Min Cost Climbing Stairs

LeetCode 746. Min Cost Climbing StairsDescription: On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two s

2017-12-25 16:01:17 285

原创 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 climb

2017-12-25 14:44:05 192

原创 LeetCode 690.Employee Importance

LeetCode 690.Employee Importance

2017-12-22 20:58:49 203

原创 LeetCode 257. Binary Tree Paths

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

2017-12-22 14:51:13 129

原创 LeetCode 113. Path Sum II

LeetCode 113. Path Sum IIDescription: Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.Example: For example: Given the below binary tree and

2017-12-19 09:24:00 130

原创 LeetCode 112. Path Sum

这里写链接内容Description: 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.Example: For example: Giv

2017-12-19 08:45:40 125

原创 LeetCode 109. Convert Sorted List to Binary Search Tree

LeetCode 109. Convert Sorted List to Binary Search TreeDescription: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem

2017-12-18 20:58:31 146

原创 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. For this problem, a height-

2017-12-18 15:39:35 115

原创 LeetCode 111. Minimum Depth of Binary Tree

LeetCode 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 to the nea

2017-12-18 14:31:37 110

原创 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 the d

2017-12-18 14:19:26 119

原创 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 t

2017-12-18 09:42:09 120

原创 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).Example 1: For example, this binary tree [1,2,2,3,4,4,3] is s

2017-12-16 21:14:37 158

原创 LeetCode 100.Same Tree

LeetCode 100.Same TreeDescription: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and

2017-12-16 19:28:57 140

原创 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 ord

2017-12-14 23:31:23 128

原创 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 (size t

2017-12-14 20:45:33 111

原创 LeetCode 119. Pascal's Triangle II

LeetCode 119. Pascal’s Triangle IIDescription: Given an index k, return the kth row of the Pascal’s triangle. For example, given k = 3, Return [1,3,3,1].分析: 可以在118题修改一下,返回res[rowIndex]即可。具

2017-12-14 19:54:56 121

原创 LeetCode 118. Pascal's Triangle

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

2017-12-14 19:22:51 137

原创 LeetCode 122. Best Time to Buy and Sell Stock II

LeetCode 122. Best Time to Buy and Sell Stock IIDescription: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profi

2017-12-13 19:39:25 96

原创 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 allocat

2017-12-12 09:44:08 113

原创 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].分析: 首先先

2017-12-12 09:19:50 139

原创 LeetCode 219.Contains Duplicate II

LeetCode 219.Contains Duplicate IIDescription: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the ab

2017-12-12 08:39:39 149

原创 LeetCode 136.Single Number

LeetCode 136.Single NumberDescription: Given an array of integers, every element appears twice except for one. Find that single one.分析: 首先给数组按从小到大排序,然后遍历该数组,判断相邻之间的数是否相等; 若不等,则把标记flag置为true,可用来

2017-12-11 20:28:56 174

原创 LeetCode 268.Missing Number

LeetCode 268.Missing NumberDescription: Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1: Input: [3,0,1] Output: 2Ex

2017-12-11 19:48:17 131

原创 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 must

2017-12-11 18:47:43 77

原创 LeetCode 283.Move Zeroes

LeetCode 283.Move ZeroesDescription: Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For example, given nums

2017-12-11 17:22:36 110

原创 LeetCode 414.Third Maximum Number

LeetCode 414.Third Maximum NumberDescription: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity

2017-12-10 13:40:51 266

原创 LeetCode 442.Find All Duplicates in an Array

LeetCode 442.Find All Duplicates in an ArrayDescription: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that

2017-12-02 14:10:02 106

原创 LeetCode 448.Find All Numbers Disappeared in an Array

LeetCode 448.Find All Numbers Disappeared in an ArrayDescription: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the

2017-12-02 14:05:46 139

原创 LeetCode 561.Array Partition I

LeetCode 561.Array Partition IDescription: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai,

2017-12-02 12:53:04 195

空空如也

空空如也

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

TA关注的人

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