- 博客(511)
- 资源 (7)
- 收藏
- 关注
原创 leetcode 289. Game of Life
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton(细胞自动机) devised by the British mathematician John Horton Conway in 1970."Given a board
2017-09-07 19:38:59 352
转载 macbook频繁掉线的解决办法
macbook在家老是掉线, 平均几分钟就掉, baidu了下也没找到解决办法, 还是得靠google啊!转自Wifi Keeps Dropping Macbook Pro 13in Retina Early 2015一. 断开wifi二. 打开finder三. 使用快捷键Cmd+Shft+G, 进入文件夹/Library/Preferences/SystemCon
2017-09-06 21:47:59 20229 1
原创 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: 7236Explana
2017-09-06 21:43:44 2393
原创 leetcode 410. Split Array Largest Sum
Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among these m sub
2017-09-06 15:21:13 457
原创 leetcode 672. Bulb Switcher II
There is a room with n lights which are turned on initially and 4 buttons on the wall. After performing exactly m unknown operations towards buttons, you need to return how many different kinds of
2017-09-05 22:34:03 2410
原创 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 twoor zero sub-node. If the node has two sub-nodes, then this node's v
2017-09-05 14:38:43 500
原创 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 (partial c
2017-09-05 13:51:27 320
原创 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, so the r
2017-09-04 17:13:08 2202 1
原创 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
2017-09-04 15:43:19 1126
原创 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 6 / \
2017-09-04 14:29:59 1973
原创 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, a2, a3,
2017-09-03 16:00:57 314
原创 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 number.The r
2017-09-03 14:41:21 1375
原创 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 represented by
2017-09-02 20:18:37 443
原创 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 constructed f
2017-09-02 19:32:33 1350
原创 leetcode 154. Find Minimum in Rotated Sorted Array II
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose an array sorted in ascending order is rotated
2017-09-02 10:45:30 292
原创 leetcode 407. Trapping Rain Water II
Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining.
2017-08-30 17:04:22 537
原创 leetcode 162. Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in
2017-08-30 14:27:05 274
原创 leetcode 110. Balanced Binary Tree
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 depth of the two subtrees of every node never diffe
2017-08-30 13:44:46 333
原创 leetcode 313. Super Ugly Number
Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4, 7, 8, 13,
2017-08-29 17:33:59 280
原创 leetcode 75. Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers
2017-08-29 13:37:13 278
原创 leetcode 501. Find Mode in Binary Search Tree
Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.Assume a BST is defined as follows:The left subtree of a node c
2017-08-28 17:25:39 355
原创 leetcode 488. Zuma Game(祖玛游戏)
Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand.Each time, you may choose a ball i
2017-08-28 15:55:41 2113 1
原创 leetcode 459. Repeated Substring Pattern
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase Engli
2017-08-27 17:11:03 596
原创 leetcode 367. Valid Perfect Square
Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16Return
2017-08-27 15:12:26 283
原创 leetcode 514. Freedom Trail
In the video game Fallout 4(辐射4), the quest(追寻,探索) "Road to Freedom" requires players to reach a metal dial(表盘,拨号盘) called the "Freedom Trail Ring", and use the dial to spell a specific keyword in ord
2017-08-27 14:03:26 798
原创 leetcode 24. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2017-08-26 15:06:47 322
原创 leetcode 257. Binary Tree Paths
Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]这道题蛮简
2017-08-26 14:10:33 289
原创 leetcode 300. Longest Increasing Subsequence
Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], ther
2017-08-26 13:43:22 333
原创 leetcode 633. Sum of Square Numbers
Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c.Example 1:Input: 5Output: TrueExplanation: 1 * 1 + 2 * 2 = 5Example
2017-08-25 17:11:49 515
原创 leetcode 64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at a
2017-08-21 14:36:58 218
原创 leetcode 342. Power of Four
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example:Given num = 16, return true. Given num = 5, return false.Follow up: Could you solve it without
2017-08-21 13:57:19 216
原创 java如何修改String中的一个字符
String str = "Test string";StringBuilder strBuilder = new StringBuilder(str);strBuilder.setCharAt(1, 'X');str=Builder.toString();String不可变StringBuilder可变参考:http://stackoverflow.com/questi
2017-08-21 13:30:54 20772
原创 leetcode 345. Reverse Vowels(元音字母) of a String
Write a function that takes a string as input and reverse only the vowels(元音字母) of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede".
2017-08-21 13:27:52 348
原创 leetcode 118. Pascal's Triangle(杨辉三角)
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]简单题一个。public List>
2017-08-20 17:20:19 233
原创 leetcode 48. Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?这道题属于那种,只要做过了知道了解法,做出来就很容易的那种。然后我是第一次做,我的解法比较复杂。比如说
2017-08-20 15:48:32 229
原创 leetcode 240. 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 in
2017-08-20 13:54:10 215
原创 leetcode 66. Plus One
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, except the number 0 itself.The digi
2017-08-19 15:39:37 215
原创 leetcode 101. Symmetric(对称的) Tree
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 symmetric: 1 / \ 2 2 / \ / \3 4 4 3
2017-08-19 15:07:57 372
原创 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:Input:
2017-08-19 14:24:30 364
原创 leetcode 198. House Robber
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 robbing each of them is that adjacent h
2017-08-18 17:24:45 216
[数学建模方法与分析].(新西兰)Mark.M.Meerschaert.清晰PDF版
2017-09-15
有名的combobox下拉框插件压缩后的js版本
2016-09-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人