随笔分类 - Math
发表于 2021-05-19 00:05阅读:106评论:0推荐:0
摘要:首先,先来想一个简单的情况,就是数组中只有一个出现一次的数字,其余的数字都出现偶数次,找出这个只出现一次的数字。如果对异或熟悉的话,很容易想到使用异或来对数组中出现偶数次的数字进行过滤,因为对同一个数字异或偶数次,相当于没有改变。那么,我们对数组中的所有数字都进行异或的话,最后得到的结果就是我们要找
阅读全文 »
发表于 2020-11-28 19:01阅读:2692评论:0推荐:0
摘要:之前学校里有组织全国大学生数学竞赛,正好我这段时间这在复习考研数学,然后就顺便报名参加了。之前在大学里的时候还真没有参加过这类的比赛,一方面是因为自己就大一的时候学了数学,剩下的时间里就很少在学习数学了。正好这次有机会参赛,而且最近也有再复习数学,可以弥补一下自己在大学期间没有参加过这类比赛的缺憾。
阅读全文 »
发表于 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-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
阅读全文 »