随笔分类 -  Math

摘要: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 < 阅读全文
posted @ 2019-05-17 21:59 Veritas_des_Liberty 阅读(291) 评论(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 阅读全文
posted @ 2019-05-17 20:56 Veritas_des_Liberty 阅读(185) 评论(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 阅读全文
posted @ 2019-05-17 17:00 Veritas_des_Liberty 阅读(273) 评论(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 阅读全文
posted @ 2019-05-16 22:34 Veritas_des_Liberty 阅读(299) 评论(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 阅读全文
posted @ 2019-05-15 22:30 Veritas_des_Liberty 阅读(290) 评论(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 阅读全文
posted @ 2019-05-15 22:08 Veritas_des_Liberty 阅读(271) 评论(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 阅读全文
posted @ 2019-05-14 22:30 Veritas_des_Liberty 阅读(226) 评论(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: 阅读全文
posted @ 2019-05-14 21:23 Veritas_des_Liberty 阅读(202) 评论(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 阅读全文
posted @ 2019-05-14 20:42 Veritas_des_Liberty 阅读(232) 评论(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 阅读全文
posted @ 2019-05-14 20:05 Veritas_des_Liberty 阅读(173) 评论(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 阅读全文
posted @ 2019-05-13 21:28 Veritas_des_Liberty 阅读(219) 评论(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  阅读全文
posted @ 2019-05-12 22:07 Veritas_des_Liberty 阅读(200) 评论(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 阅读全文
posted @ 2019-05-12 21:49 Veritas_des_Liberty 阅读(244) 评论(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 阅读全文
posted @ 2019-05-05 21:14 Veritas_des_Liberty 阅读(278) 评论(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 阅读全文
posted @ 2019-05-05 20:34 Veritas_des_Liberty 阅读(222) 评论(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 阅读全文
posted @ 2019-05-05 19:47 Veritas_des_Liberty 阅读(202) 评论(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 阅读全文
posted @ 2019-05-04 21:51 Veritas_des_Liberty 阅读(241) 评论(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 阅读全文
posted @ 2019-05-04 17:31 Veritas_des_Liberty 阅读(265) 评论(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 阅读全文
posted @ 2019-05-03 15:28 Veritas_des_Liberty 阅读(225) 评论(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 阅读全文
posted @ 2019-05-03 12:37 Veritas_des_Liberty 阅读(296) 评论(0) 推荐(0)