LeetCode 数论
文章平均质量分 69
BoomHusky
计算机专业硕士,希望自己的实力能够更强
展开
-
LeetCode | 371. Sum of Two Integers不用加号做加法
Calculate the sum of two integers a and b,but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.Credits:Special thanks to @fujiaozhu foradding this proble原创 2018-01-31 19:22:45 · 433 阅读 · 0 评论 -
LeetCode | 672. Bulb Switcher II数学原理题解析
Thereis a room with n lights whichare turned on initially and 4 buttons on the wall. After performing exactly m unknown operations towards buttons, you need to return howmany different kinds of st原创 2018-02-01 20:04:36 · 718 阅读 · 0 评论 -
LeetCode | 767. Reorganize String调整字符串使得字符串相同字符不相邻
Givena string S, check if the letters can berearranged so that two characters that are adjacent to each other are not thesame.Ifpossible, output any possible result. If not possible, return the e原创 2018-02-04 15:27:35 · 2864 阅读 · 0 评论 -
LeetCode | 779. K-th Symbol in Grammar数学原理题
Onthe first row, we write a 0. Now in every subsequent row, we look at the previous rowand replace each occurrence of 0 with 01, and each occurrence of 1 with 10.Givenrow N and index K, return原创 2018-02-04 15:39:49 · 609 阅读 · 0 评论 -
LeetCode | 372. Super Pow 数学原理题
Yourtask is to calculate ab mod 1337 where a is a positive integer and b isan extremely large positive integer given in the form of an array.Example1:a = 2b = [3] Result: 8Example2原创 2018-01-30 16:51:24 · 177 阅读 · 0 评论 -
LeetCode | 400. Nth Digit 数学原理题
Find the nth digitof 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-bitsigned integer (n < 231).Example 1:Input:3 Outpu...原创 2018-03-07 18:51:16 · 216 阅读 · 0 评论 -
LeetCode | 357. Count Numbers with Unique Digits 数论
Given a non-negative integer n, count all numbers withunique digits, x, where 0 ≤ x < 10n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of0 ≤ x < 100, excl...原创 2018-05-01 16:42:32 · 122 阅读 · 0 评论 -
LeetCode | 365. Water and Jug Problem 数学原理详细分析
Youare given two jugs with capacities x and y litres.There is an infinite amount of water supply available. You need to determinewhether it is possible to measure exactly z litresusing these two jugs....原创 2018-05-17 10:42:12 · 865 阅读 · 0 评论 -
LeetCode | 204. Count Primes 数论 素数筛选,厄拉多塞筛法
Count the number of prime numbers less than a non-negativenumber, n.Example:Input: 10Output: 4Explanation: There are 4 prime numbers less than10, they are 2, 3, 5, 7.这一题给你一个n,让你统计小于N的所有的素数的个数。假如按照传统的方...原创 2018-06-07 15:39:51 · 430 阅读 · 0 评论