摘要:
solution: The basic idea here is to label all appeared numbers in the array. Since we don't want to introduce extra space and given all numbers are po 阅读全文
摘要:
从问题Number of Digit One延伸来,计算从1到给定的数字n共n个数字中,数字X出现的次数。 直观上来看,如果X是1-8之间的数字,那规律和之前在Number of Digit One 中分析的是一样的,因为对每个digit上的数字进行分析的话,都需要考虑三种情况,即给定的n上该位数字 阅读全文
摘要:
题目:Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. (LeetCode 233) Hint: 提示放在最后面了 阅读全文
摘要:
题目:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. (LeetCode 51) Given an integ 阅读全文
摘要:
题目:Given an integer n, return the number of trailing zeroes in n!.(Leetcode 172) Note: Your solution should be in logarithmic time complexity. C++参考框架 阅读全文