05 2019 档案
发表于 2019-05-31 22:30阅读:172评论:0推荐:0
摘要:Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing su
阅读全文 »
发表于 2019-05-31 21:18阅读:24189评论:0推荐:0
摘要: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 i
阅读全文 »
发表于 2019-05-30 22:32阅读:252评论:0推荐:0
摘要:Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one s
阅读全文 »
发表于 2019-05-30 22:00阅读:223评论:0推荐:0
摘要:Given a reference of a node in a connected undirected graph, return a deep copy (clone) of the graph. Each node in the graph contains a val (int) and
阅读全文 »
发表于 2019-05-29 16:31阅读:335评论:0推荐:0
摘要:Given a number N, return a string consisting of "0"s and "1"s that represents its value in base -2 (negative two). The returned string must have no le
阅读全文 »
发表于 2019-05-29 15:53阅读:380评论:0推荐:0
摘要:On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L
阅读全文 »
发表于 2019-05-28 22:04阅读:285评论:0推荐:0
摘要:Given an array A of non-negative integers, the array is squareful if for every pair of adjacent elements, their sum is a perfect square. Return the nu
阅读全文 »
发表于 2019-05-28 20:58阅读:317评论:0推荐:0
摘要:On a broken calculator that has a number showing on its display, we can perform two operations: Double: Multiply the number on the display by 2, or; D
阅读全文 »
发表于 2019-05-27 22:35阅读:210评论:0推荐:0
摘要:Given an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, formed from 3 of these lengths. If it is impossib
阅读全文 »
发表于 2019-05-26 12:43阅读:230评论:0推荐:0
摘要:1051. Height Checker Students are asked to stand in non-decreasing order of heights for an annual photo. Return the minimum number of students not sta
阅读全文 »
发表于 2019-05-24 22:13阅读:277评论:0推荐:0
摘要:Given a set of points in the xy-plane, determine the minimum area of any rectangle formed from these points, with sides not necessarily parallel to th
阅读全文 »
发表于 2019-05-23 21:43阅读:203评论:0推荐:0
摘要:Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i]. After this process, we have some array B
阅读全文 »
发表于 2019-05-23 21:28阅读:347评论:0推荐:0
摘要:Let's say a positive integer is a superpalindrome if it is a palindrome, and it is also the square of a palindrome. Now, given two positive integers L
阅读全文 »
发表于 2019-05-23 20:30阅读:266评论:0推荐:0
摘要:On a N * N grid, we place some 1 * 1 * 1 cubes. Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j). Return the
阅读全文 »
发表于 2019-05-22 18:59阅读:262评论:0推荐:0
摘要:On a 2 dimensional grid with R rows and C columns, we start at (r0, c0) facing east. Here, the north-west corner of the grid is at the first row and c
阅读全文 »
发表于 2019-05-21 16:46阅读:297评论:0推荐:0
摘要:Given the radius and x-y positions of the center of a circle, write a function randPoint which generates a uniform random point in the circle. Note: E
阅读全文 »
发表于 2019-05-20 22:31阅读:251评论:0推荐:0
摘要:Starting with a positive integer N, we reorder the digits in any order (including the original order) such that the leading digit is not zero. Return
阅读全文 »
发表于 2019-05-20 21:51阅读:294评论:0推荐:0
摘要:Find the smallest prime palindrome greater than or equal to N. Recall that a number is prime if it's only divisors are 1 and itself, and it is greater
阅读全文 »
发表于 2019-05-19 15:21阅读:390评论:0推荐:0
摘要:1046. Last Stone Weight We have a collection of rocks, each rock has a positive integer weight. Each turn, we choose the two heaviest rocks and smash
阅读全文 »
发表于 2019-05-18 22:33阅读:224评论:0推荐:0
摘要:There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining c
阅读全文 »
发表于 2019-05-18 22:00阅读:210评论:0推荐:0
摘要:Given a positive integer N, how many ways can we write it as a sum of consecutive positive integers? Example 1: Example 2: Example 3: Note: 1 <= N <=
阅读全文 »
发表于 2019-05-18 21:41阅读:210评论:0推荐:0
摘要: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
阅读全文 »
发表于 2019-05-17 21:59阅读:281评论:0推荐:0
摘要:You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points. Notes: 3 <= points.length <
阅读全文 »
发表于 2019-05-17 20:56阅读:178评论:0推荐: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
阅读全文 »
发表于 2019-05-17 17:37阅读:306评论:0推荐:0
摘要:A Tic-Tac-Toe board is given as a string array board. Return True if and only if it is possible to reach this board position during the course of a va
阅读全文 »
发表于 2019-05-17 17:00阅读:265评论:0推荐: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
阅读全文 »
发表于 2019-05-16 22:34阅读:286评论:0推荐:0
摘要:There is a box protected by a password. The password is n digits, where each letter can be one of the first k digits 0, 1, ..., k-1. You can keep inpu
阅读全文 »
发表于 2019-05-15 22:30阅读:280评论:0推荐:0
摘要: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
阅读全文 »
发表于 2019-05-15 22:08阅读:262评论:0推荐:0
摘要:You are standing at position 0 on an infinite number line. There is a goal at position target. On each move, you can either go left or right. During t
阅读全文 »
发表于 2019-05-14 22:30阅读:223评论:0推荐:0
摘要: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 n
阅读全文 »
发表于 2019-05-14 21:23阅读:195评论:0推荐:0
摘要: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: Example 2: Approach #1:
阅读全文 »
发表于 2019-05-14 20:42阅读:227评论:0推荐:0
摘要:Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final
阅读全文 »
发表于 2019-05-14 20:05阅读:170评论:0推荐:0
摘要:Given the coordinates of four points in 2D space, return whether the four points could construct a square. The coordinate (x,y) of a point is represen
阅读全文 »
发表于 2019-05-13 21:28阅读:214评论:0推荐:0
摘要:There are 1000 buckets, one and only one of them is poisonous, while the rest are filled with water. They all look identical. If a pig drinks the pois
阅读全文 »
发表于 2019-05-12 22:07阅读:197评论:0推荐:0
摘要:Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n
阅读全文 »
发表于 2019-05-12 21:49阅读:238评论:0推荐:0
摘要:Given a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order. Note: Example 1: Input
阅读全文 »
发表于 2019-05-05 21:14阅读:274评论:0推荐:0
摘要:Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positive and will fit within the range of a 32-bi
阅读全文 »
发表于 2019-05-05 20:34阅读:215评论:0推荐:0
摘要:Given a positive integer n and you can do operations as follow: What is the minimum number of replacements needed for n to become 1? Example 1: Exampl
阅读全文 »
发表于 2019-05-05 19:47阅读:197评论:0推荐:0
摘要:Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a
阅读全文 »
发表于 2019-05-04 21:51阅读:224评论:0推荐:0
摘要:You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is poss
阅读全文 »
发表于 2019-05-04 17:31阅读:250评论:0推荐:0
摘要:You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[2] metres
阅读全文 »
发表于 2019-05-03 15:28阅读:220评论:0推荐:0
摘要:There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every
阅读全文 »
发表于 2019-05-03 12:37阅读:290评论:0推荐:0
摘要:Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. Example: Approach #1: Math. [Jav
阅读全文 »
发表于 2019-05-03 11:32阅读:184评论:0推荐:0
摘要:Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or
阅读全文 »
发表于 2019-05-01 11:24阅读:283评论:0推荐:0
摘要:We are given that the string "abc" is valid. From any valid string V, we may split V into two pieces X and Y such that X + Y (X concatenated with Y) i
阅读全文 »
发表于 2019-05-01 11:07阅读:356评论:0推荐:0
摘要:You have an array of logs. Each log is a space delimited string of words. For each log, the first word in each log is an alphanumeric identifier. Then
阅读全文 »