摘要:
You have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes. Given an integer n, return the number of ways to t
阅读全文
posted @ 2018-06-13 19:58
Grandyang
阅读(6238)
推荐(0)
摘要:
You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (target[0], target[1]). There are several ghosts on t
阅读全文
posted @ 2018-06-11 08:00
Grandyang
阅读(3034)
推荐(0)
摘要:
X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotate
阅读全文
posted @ 2018-06-08 11:56
Grandyang
阅读(5540)
推荐(0)
摘要:
Vim是公认的终端编辑神器,配置文件设置的好,再加上各种功能的插件,更能使其如虎添翼,下面就分享出博主的配置文件,也是从网上大神那里拷过来的。配置文件在用户目录下~/.vimrc ,如果没有,就自己创建一个。 安装插件管家Vundle: 然后再建立一个插件的文件,如果没有,就创建一个 ~/.vimr
阅读全文
posted @ 2018-06-06 07:19
Grandyang
阅读(5349)
推荐(0)
摘要:
A sorted list A contains 1, plus some number of primes. Then, for every p < q in the list, we consider the fraction p/q. What is the K-th smallest fra
阅读全文
posted @ 2018-06-04 19:59
Grandyang
阅读(4797)
推荐(0)
摘要:
There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. Now given all the cities and fights, togethe
阅读全文
posted @ 2018-05-30 11:31
Grandyang
阅读(12504)
推荐(0)
摘要:
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible stri
阅读全文
posted @ 2018-05-21 09:21
Grandyang
阅读(6193)
推荐(1)
摘要:
Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa
阅读全文
posted @ 2018-05-19 23:46
Grandyang
阅读(4801)
推荐(0)
摘要:
An N x N board contains only 0s and 1s. In each move, you can swap any 2 rows with each other, or any 2 columns with each other. What is the minimum n
阅读全文
posted @ 2018-05-17 22:32
Grandyang
阅读(5206)
推荐(1)
摘要:
In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Th
阅读全文
posted @ 2018-05-15 23:39
Grandyang
阅读(4317)
推荐(1)
摘要:
A move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y). Given a starting point (sx, sy) and a target point (tx, t
阅读全文
posted @ 2018-05-13 23:22
Grandyang
阅读(5529)
推荐(0)
摘要:
On the first row, we write a 0. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence
阅读全文
posted @ 2018-05-11 23:55
Grandyang
阅读(5062)
推荐(0)
摘要:
On an N x N grid, each square grid[i][j] represents the elevation at that point (i,j). Now rain starts to fall. At time t, the depth of the water ever
阅读全文
posted @ 2018-05-09 23:26
Grandyang
阅读(6078)
推荐(1)
摘要:
In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or repla
阅读全文
posted @ 2018-05-07 10:54
Grandyang
阅读(5856)
推荐(0)
摘要:
Given a Binary Search Tree (BST) with root node root, and a target value V, split the tree into two subtrees where one subtree has nodes that are all
阅读全文
posted @ 2018-05-04 23:40
Grandyang
阅读(6068)
推荐(0)
摘要:
We have some permutation A of [0, 1, ..., N - 1], where N is the length of A. The number of (global) inversions is the number of i < j with 0 <= i < j
阅读全文
posted @ 2018-05-02 23:07
Grandyang
阅读(3327)
推荐(1)
摘要:
On a horizontal number line, we have gas stations at positions stations[0], stations[1], ..., stations[N-1], where N = stations.length. Now, we add K
阅读全文
posted @ 2018-04-28 23:59
Grandyang
阅读(7240)
推荐(1)
摘要:
On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally
阅读全文
posted @ 2018-04-26 23:31
Grandyang
阅读(8115)
推荐(0)
摘要:
Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1]
阅读全文
posted @ 2018-04-24 23:22
Grandyang
阅读(5917)
推荐(0)
摘要:
You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in Sis a type of stone
阅读全文
posted @ 2018-04-22 23:37
Grandyang
阅读(4615)
推荐(0)
摘要:
话说博主在写 Max Chunks To Make Sorted II 这篇帖子的解法四时,写到使用单调栈Monotone Stack的解法时,突然脑中触电一般,想起了之前曾经在此贴 LeetCode All in One 题目讲解汇总(持续更新中...) 的留言区中说要写单调栈的总结帖,当时答应了
阅读全文
posted @ 2018-04-20 07:31
Grandyang
阅读(40723)
推荐(2)
摘要:
Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or
阅读全文
posted @ 2018-04-18 11:58
Grandyang
阅读(27429)
推荐(1)
摘要:
This question is the same as "Max Chunks to Make Sorted" except the integers of the given array are not necessarily distinct, the input array could be
阅读全文
posted @ 2018-04-15 23:51
Grandyang
阅读(7362)
推荐(1)
摘要:
Given an array arr that is a permutation of [0, 1, ..., arr.length - 1], we split the array into some number of "chunks" (partitions), and individuall
阅读全文
posted @ 2018-04-13 21:05
Grandyang
阅读(5465)
推荐(0)
摘要:
Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same. If possible, output
阅读全文
posted @ 2018-04-11 23:40
Grandyang
阅读(12233)
推荐(0)
摘要:
Given an array of characters, compress it in-place. The length after compression must always be smaller than or equal to the original array. Every ele
阅读全文
posted @ 2018-04-08 05:38
Grandyang
阅读(11511)
推荐(1)
摘要:
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the m
阅读全文
posted @ 2018-04-06 23:42
Grandyang
阅读(7537)
推荐(0)
摘要:
N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number of swaps so that every couple is sitting side b
阅读全文
posted @ 2018-04-04 12:31
Grandyang
阅读(6783)
推荐(2)
摘要:
在iOS开发中,按钮图标可以放三种大小,常见的是22x22,44x44,66x66,一般来说我们可以在PS中做好图片后,再分别导出三种大小的图标,但是每次要修改图片的大小,操作比较繁琐。这里博主推荐一种使用命令行来快速对图片的大小进行转换,比如我们用PS做好了图以后,先导出66x66大小的图片,命名
阅读全文
posted @ 2018-04-01 06:16
Grandyang
阅读(1210)
推荐(0)
摘要:
Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W. If there is no such window in S that covers al
阅读全文
posted @ 2018-03-31 23:54
Grandyang
阅读(15279)
推荐(1)
摘要:
In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. What is the largest axis-alig
阅读全文
posted @ 2018-03-30 23:28
Grandyang
阅读(4703)
推荐(0)
摘要:
Given a chemical formula (given as a string), return the count of each atom. The atomic element always starts with an uppercase character, then zero o
阅读全文
posted @ 2018-03-28 23:44
Grandyang
阅读(5327)
推荐(0)
摘要:
A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one p
阅读全文
posted @ 2018-03-26 23:25
Grandyang
阅读(12365)
推荐(0)
摘要:
Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary representation
阅读全文
posted @ 2018-03-24 23:55
Grandyang
阅读(4240)
推荐(1)
摘要:
Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pair (A, B) is defined as the absolute difference bet
阅读全文
posted @ 2018-03-22 23:48
Grandyang
阅读(8582)
推荐(0)
摘要:
Github中单个文件的大小限制是100MB,为了能突破这个限制,我们需要使用Git Large File Storage这个工具,参见这个官方帖子,但是按照其给的步骤,博主未能成功上传超大文件,那么这里就给出自己成功的步骤吧:
阅读全文
posted @ 2018-03-20 07:06
Grandyang
阅读(2768)
推荐(0)
摘要:
Special binary strings are binary strings with the following two properties: The number of 0's is equal to the number of 1's. Every prefix of the bina
阅读全文
posted @ 2018-03-19 23:56
Grandyang
阅读(6419)
推荐(1)
摘要:
A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner. addRan
阅读全文
posted @ 2018-03-16 23:53
Grandyang
阅读(5846)
推荐(0)
摘要:
Given two lists A and B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find
阅读全文
posted @ 2018-03-14 23:53
Grandyang
阅读(4284)
推荐(0)
摘要:
We are given a list schedule of employees, which represents the working time for each employee. Each employee has a list of non-overlapping Intervals,
阅读全文
posted @ 2018-03-12 22:49
Grandyang
阅读(9097)
推荐(0)