摘要:
There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to t
阅读全文
posted @ 2019-02-17 23:57
Grandyang
阅读(4199)
推荐(2)
摘要:
Alice plays the following game, loosely based on the card game "21". Alice starts with 0 points, and draws numbers while she has less than K points. D
阅读全文
posted @ 2019-02-15 23:58
Grandyang
阅读(7015)
推荐(1)
摘要:
A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates
阅读全文
posted @ 2019-02-12 23:43
Grandyang
阅读(4640)
推荐(1)
摘要:
Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.) Your car drives automatically accord
阅读全文
posted @ 2019-02-10 23:46
Grandyang
阅读(6733)
推荐(0)
摘要:
Two images A and B are given, represented as binary, square matrices of the same size. (A binary matrix has only 0s and 1s as values.) We translate on
阅读全文
posted @ 2019-02-07 21:44
Grandyang
阅读(5747)
推荐(1)
摘要:
To some string S, we will perform some replacement operations that replace groups of letters with new ones (not necessarily the same size). Each repla
阅读全文
posted @ 2019-02-04 22:42
Grandyang
阅读(4049)
推荐(0)
摘要:
Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means t
阅读全文
posted @ 2019-02-02 23:56
Grandyang
阅读(2232)
推荐(0)
摘要:
We are given a personal information string S, which may represent either an email address or a phone number. We would like to mask this personal infor
阅读全文
posted @ 2019-01-30 23:48
Grandyang
阅读(1743)
推荐(0)
摘要:
In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g
阅读全文
posted @ 2019-01-28 22:21
Grandyang
阅读(1849)
推荐(0)
摘要:
Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size. Each person may dislike some other peopl
阅读全文
posted @ 2019-01-24 22:08
Grandyang
阅读(4724)
推荐(0)
摘要:
The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding one
阅读全文
posted @ 2019-01-22 23:57
Grandyang
阅读(5279)
推荐(1)
摘要:
We have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7], this means that t
阅读全文
posted @ 2019-01-20 05:58
Grandyang
阅读(4892)
推荐(0)
摘要:
In a given integer array A, we must move every element of A to either list B or list C. (B and C initially start empty.) Return true if and only if af
阅读全文
posted @ 2019-01-17 23:56
Grandyang
阅读(4615)
推荐(0)
摘要:
We have jobs: difficulty[i] is the difficulty of the ith job, and profit[i] is the profit of the ith job. Now we have some workers. worker[i] is the a
阅读全文
posted @ 2019-01-14 00:00
Grandyang
阅读(2507)
推荐(0)
摘要:
Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT friend request pers
阅读全文
posted @ 2019-01-10 23:12
Grandyang
阅读(3324)
推荐(0)
摘要:
A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the
阅读全文
posted @ 2019-01-08 01:36
Grandyang
阅读(2490)
推荐(0)
摘要:
Given an array of unique integers, each integer is strictly greater than 1. We make a binary tree using these integers and each number may be used for
阅读全文
posted @ 2019-01-05 00:00
Grandyang
阅读(2183)
推荐(0)
摘要:
On a table are N cards, with a positive integer printed on the front and back of each card (possibly different). We flip any number of cards, and afte
阅读全文
posted @ 2018-12-23 07:49
Grandyang
阅读(2382)
推荐(0)
摘要:
After install the Nginx on AWS instance, and visit your public ip address, you might see the following: This site can't be reached xxx.xxx.xx take too
阅读全文
posted @ 2018-12-16 06:41
Grandyang
阅读(1622)
推荐(0)
摘要:
Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Example 1: Inpu
阅读全文
posted @ 2018-12-13 11:59
Grandyang
阅读(2627)
推荐(0)
摘要:
Given a list of words, we may encode it by writing a reference string S and a list of indexes A. For example, if the list of words is ["time", "me", "
阅读全文
posted @ 2018-12-08 23:48
Grandyang
阅读(3161)
推荐(0)
摘要:
Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at leas
阅读全文
posted @ 2018-12-04 00:57
Grandyang
阅读(3653)
推荐(0)
摘要:
使用MongoDB的时候,如果遇到下面这个错误: 一般来说是MongoDB数据库的Model没有链上,在YourScript.js的开头,一般下面几行不能少: 然后yourModel.js的内容可以为:
阅读全文
posted @ 2018-12-01 13:47
Grandyang
阅读(2700)
推荐(1)
摘要:
Go to Elastic Beanstalk -> Configuration -> Security -> Virtual machine permissions -> EC2 key pair. Choose your key pair. If you do not have one, The
阅读全文
posted @ 2018-12-01 13:32
Grandyang
阅读(565)
推荐(0)
摘要:
当你想给微信公众号(不是测试账号)自定义菜单创建接口,遇到如下错误: 很可能的原因是你并没有自定义菜单接口的权限,去【开发】->【接口权限】 界面去查看“自定义菜单”的权限,如果显示 “未获得”,那么恭喜你,用不了。而显示的获得条件是【1】订阅号必须通过微信认证 【2】服务号自动获得。但是坑爹的是,
阅读全文
posted @ 2018-12-01 13:17
Grandyang
阅读(5075)
推荐(0)
摘要:
Given a blacklist B containing unique integers from [0, N), write a function to return a uniform random integer from [0, N) which is NOT in B. Optimiz
阅读全文
posted @ 2018-11-27 23:23
Grandyang
阅读(3437)
推荐(1)
摘要:
When install the yeoman using the following command: You might have the following error: Try the following commands instead: Now try to type 'yo' to s
阅读全文
posted @ 2018-11-26 02:43
Grandyang
阅读(2381)
推荐(0)
摘要:
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello"
阅读全文
posted @ 2018-11-25 23:09
Grandyang
阅读(1705)
推荐(0)
摘要:
在使用微信官方给的添加自定义菜单的示例代码: 可能会遇到如下的错误: 原因可能是因为想展示的按钮太多了,装不下了,去掉最后两个就好了:
阅读全文
posted @ 2018-11-24 09:07
Grandyang
阅读(5185)
推荐(1)
摘要:
Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list
阅读全文
posted @ 2018-11-23 09:03
Grandyang
阅读(5906)
推荐(0)
摘要:
Given a robot cleaner in a room modeled as a grid. Each cell in the grid can be empty or blocked. The robot cleaner with 4 given APIs can move forward
阅读全文
posted @ 2018-11-20 12:39
Grandyang
阅读(15263)
推荐(2)
摘要:
When the 'fatal error: helper_math.h: No such file or directory' occurs, it means the 'helper_math.h' file is missing. In fact, 'helper_math.h' locate
阅读全文
posted @ 2018-11-19 11:24
Grandyang
阅读(2879)
推荐(0)
摘要:
Given a node from a Circular Linked List which is sorted in ascending order, write a function to insert a value insertVal into the list such that it r
阅读全文
posted @ 2018-11-19 01:15
Grandyang
阅读(6516)
推荐(0)
摘要:
Design a HashMap without using any built-in hash table libraries. Implement the MyHashMap class: MyHashMap() initializes the object with an empty map.
阅读全文
posted @ 2018-11-17 05:43
Grandyang
阅读(7998)
推荐(0)
摘要:
Design a HashSet without using any built-in hash table libraries. To be specific, your design should include these functions: add(value): Insert a val
阅读全文
posted @ 2018-11-15 23:19
Grandyang
阅读(5358)
推荐(0)
摘要:
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or
阅读全文
posted @ 2018-11-12 11:21
Grandyang
阅读(6595)
推荐(0)
摘要:
Design an algorithm to encode an N-ary tree into a binary tree and decode the binary tree to get the original N-ary tree. An N-ary tree is a rooted tr
阅读全文
posted @ 2018-11-12 11:08
Grandyang
阅读(3897)
推荐(0)
摘要:
Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.
阅读全文
posted @ 2018-11-11 09:19
Grandyang
阅读(6457)
推荐(0)
摘要:
Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists,
阅读全文
posted @ 2018-11-10 00:50
Grandyang
阅读(3721)
推荐(0)
摘要:
Given an integer array sorted in ascending order, write a function to search target in nums. If target exists, then return its index, otherwise return
阅读全文
posted @ 2018-11-09 23:58
Grandyang
阅读(4759)
推荐(0)