自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

魔豆(Magicbean)的博客

分享计算机专业的相关知识

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

原创 [Leetcode] 675. Cut Off Trees for Golf Event 解题报告

题目:You are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map:0 represents the obstacle can't be reached.1 represents the 

2018-01-31 11:21:23 977

原创 [Leetcode] 674. Longest Continuous Increasing Subsequence 解题报告

题目:Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).Example 1:Input: [1,3,5,4,7]Output: 3Explanation: The longest continuo

2018-01-31 10:25:20 200

原创 [Leetcode] 673. Number of Longest Increasing Subsequence 解题报告

题目:Given an unsorted array of integers, find the number of longest increasing subsequence.Example 1:Input: [1,3,5,4,7]Output: 2Explanation: The two longest increasing subsequence are [

2018-01-31 10:20:15 338

原创 [Leetcode] 672. Bulb Switcher II 解题报告

题目:思路:代码:

2018-01-31 09:25:14 385

原创 [Leetcode] 671. Second Minimum Node In a Binary Tree 解题报告

题目:Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then thi

2018-01-30 11:45:07 353

原创 [Leetcode] 670. Maximum Swap 解题报告

题目:Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.Example 1:Input: 2736Output: 723

2018-01-30 11:00:34 827

原创 [Leetcode] 669. Trim a Binary Search Tree 解题报告

题目:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to change the root of the tree,

2018-01-29 12:43:36 204

原创 [Leetcode] 668. Kth Smallest Number in Multiplication Table 解题报告

题目:Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table?Given the height m and the length n of a m *

2018-01-29 12:34:56 323

原创 [Leetcode] 667. Beautiful Arrangement II 解题报告

题目:Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requirement: Suppose this list is [a1,

2018-01-29 10:56:24 256

原创 [Leetcode] 666. Path Sum IV 解题报告

题目:If the depth of a tree is smaller than 5, then this tree can be represented by a list of three-digits integers.For each integer in this list:The hundreds digit represents the dept

2018-01-29 08:59:52 1271

原创 [Leetcode] 665. Non-decreasing Array 解题报告

题目:Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i]  holds for every 

2018-01-28 21:42:50 201

原创 [Leetcode] 664. Strange Printer 解题报告

题目:There is a strange printer with the following two special requirements:The printer can only print a sequence of the same character each time.At each turn, the printer can print new charac

2018-01-28 20:46:11 821

原创 [Leetcode] 663. Equal Tree Partition 解题报告

题目:Given a binary tree with n nodes, your task is to check if it's possible to partition the tree to two trees which have the equal sum of values after removing exactly one edge on the origina

2018-01-27 21:28:29 654

原创 [Leetcode] 662. Maximum Width of Binary Tree 解题报告

题目:Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as a full b

2018-01-27 11:12:35 368

原创 [Leetcode] 661. Image Smoother 解题报告

题目:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all th

2018-01-27 10:15:36 259

原创 [Leetcode] 660. Remove 9 解题报告

题目:Start from integer 1, remove any integer that contains 9 such as 9, 19, 29...So now, you will have a new integer sequence: 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, ...Given a positive integer 

2018-01-27 10:13:24 368

原创 [Leetcode] 659. Split Array into Consecutive Subsequences 解题报告

题目:You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive

2018-01-26 22:05:35 563

原创 [Leetcode] 658. Find K Closest Elements 解题报告

题目:Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there is a tie, the smaller elements are

2018-01-26 21:14:00 358

原创 [Leetcode] 657. Judge Route Circle 解题报告

题目:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.The move sequence is rep

2018-01-26 20:07:51 172

原创 [Leetcode] 656. Coin Path 解题报告

题目:Given an array A (index starts at 1) consisting of N integers: A1, A2, ..., AN and an integer B. The integer B denotes that from any place (suppose the index is i) in the array A, you

2018-01-26 20:04:37 1477

原创 [Leetcode] 655. Print Binary Tree 解题报告

题目:Print a binary tree in an m*n 2D string array following these rules:The row number m should be equal to the height of the given binary tree.The column number n should always be an odd num

2018-01-25 21:40:58 269

原创 [Leetcode] 654. Maximum Binary Tree 解题报告

题目:Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array.The left subtree is the maximum tree cons

2018-01-25 21:19:46 179

原创 [Leetcode] 653. Two Sum IV - Input is a BST 解题报告

题目:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example 1:Input: 5 / \ 3

2018-01-25 21:08:45 268

原创 [Leetcode] 652. Find Duplicate Subtrees 解题报告

题目:Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any oneof them.Two trees are duplicate if they have the s

2018-01-25 20:50:32 517

原创 [Leetcode] 651. 4 Keys Keyboard 解题报告

题目:Imagine you have a special keyboard with the following keys:Key 1: (A): Print one 'A' on screen.Key 2: (Ctrl-A): Select the whole screen.Key 3: (Ctrl-C): Copy selection to buffer.

2018-01-25 20:26:57 671

原创 [Leetcode] 650. 2 Keys Keyboard 解题报告

题目:Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step:Copy All: You can copy all the characters present on the notepad (pa

2018-01-25 12:27:08 277

原创 [Leetcode] 649. Dota2 Senate 解题报告

题目:In the world of Dota2, there are two parties: the Radiant and the Dire.The Dota2 senate consists of senators coming from two parties. Now the senate wants to make a decision about a chang

2018-01-24 20:45:30 307

原创 [Leetcode] 648. Replace Words 解题报告

题目:In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For example, the root an, followed by ot

2018-01-24 19:27:18 242

原创 [Leetcode] 647. Palindromic Substrings 解题报告

题目:Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even th

2018-01-24 18:46:05 197

原创 [Leetcode] 646. Maximum Length of Pair Chain 解题报告

题目:You are given n pairs of numbers. In every pair, the first number is always smaller than the second number.Now, we define a pair (c, d) can follow another pair (a, b) if and only if b

2018-01-24 12:40:22 270

原创 [Leetcode] 645. Set Mismatch 解题报告

题目:The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repe

2018-01-24 12:00:51 234

原创 [Leetcode] 644. Maximum Average Subarray II 解题报告

题目:Given an array consisting of n integers, find the contiguous subarray whose length is greater than or equal to k that has the maximum average value. And you need to output the maximum ave

2018-01-24 11:37:56 1538

原创 [Leetcode] 643. Maximum Average Subarray I 解题报告

题目:Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average value.Example 1:

2018-01-23 17:41:00 179

原创 [Leetcode] 642. Design Search Autocomplete System 解题报告

题目:Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character '#'). For each character they type except '#', you ne

2018-01-23 11:26:14 1333

原创 [Leetcode] 640. Solve the Equation 解题报告

题目:Solve a given equation and return the value ofxin the form of string "x=#value". The equation contains only '+', '-' operation, the variablexand its coefficient.If there is no solution f...

2018-01-23 09:57:52 350

原创 [Leetcode] 639. Decode Ways II 解题报告

题目:A message containing letters from A-Z is being encoded to numbers using the following mapping way:'A' -> 1'B' -> 2...'Z' -> 26Beyond that, now the encoded string can also contain

2018-01-22 21:24:29 506

原创 [Leetcode] 638. Shopping Offers 解题报告

题目:In LeetCode Store, there are some kinds of items to sell. Each item has a price.However, there are some special offers, and a special offer consists of one or more different kinds of item

2018-01-22 19:48:31 390

原创 [Leetcode] 637. Average of Levels in Binary Tree 解题报告

题目:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3 / \ 9 20 / \ 15 7Output: [3, 14.5, 11]E

2018-01-22 11:18:27 256

原创 [Leetcode] 636. Exclusive Time of Functions 解题报告

题目:Given the running logs of n functions that are executed in a nonpreemptive single threaded CPU, find the exclusive time of these functions.Each function has a unique id, start from 0 to n

2018-01-22 11:04:36 278

原创 [Leetcode] 635. Design Log Storage System 解题报告

题目:You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour:Minute:Second, for example, 2017:01:01:

2018-01-22 10:24:08 2318

空空如也

空空如也

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

TA关注的人

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