Nth Digit【難】
這題我只想到最粗暴的暴力解法。。。
感覺不應該是easy阿,感覺都快有Hard的難度了!!!!
long變數。
這個答案的原理是一樣的,但是更容易理解。 先求出第n個digit是在一個多大的數裡?這個數是在1--9範圍?10-99範圍?100---999範圍?。。。
最關鍵的一個就是n - digit * count > 0. 還有就是理解 counts 為什麼是9, 90, 900. 這個是怎麼想出來的。
n-1的原因是因為是0 index based。第n個是在n-1 index.
(n-1) / digit 就是 如果如果沒有這個digit位數長的話, 就是0.
由於n -= digit*count 也就是n= 比這個current level 大多少?
相關文章
- Nth Digit 第N個數字Git
- Leetcode 400.Nth DigitLeetCodeGit
- Martyr2專案實現——Number部分的問題求解 (1) Find Pi to Nth DigitGit
- 【CSS】nth-child 與 nth-of-type辨析CSS
- CSS3偽類選擇器:nth-child()(nth-child(odd)/nth-child(even))CSSS3
- Last digit of a huge numberASTGit
- ZOJ First Digit(瞎搞)Git
- jQuery :nth-child()jQuery
- jQuery :nth-of-type()jQuery
- nth-of-type()和nth-child()選擇器的區別
- CSS中nth-child和nth-of-type的簡單使用CSS
- jQuery :nth-last-of-type()jQueryAST
- jQuery :nth-last-child()jQueryAST
- nth-child和nth-of-type這倆偽類有毛關係?
- LintCode-Digit CountsGit
- CSS E:nth-child(n)CSS
- CSS E:nth-of-type(n)CSS
- 教你發現CSS3的"nth-child"和"nth-of-type"的區別!CSSS3
- LeetCode-Number of Digit OneLeetCodeGit
- 233. Number of Digit OneGit
- UVa 1225 - Digit CountingGit
- HDU 1060 Leftmost DigitGit
- CSS E:nth-last-of-type(n)CSSAST
- CSS E:nth-last-child(n)CSSAST
- Digit Counting uva1225Git
- 19. Remove Nth Node From End of ListREM
- nth-child() 選擇器用法詳解
- nth-of-type()選擇器用法詳解
- css3 nth-child選擇器CSSS3
- Leetcode Remove Nth Node From End of ListLeetCodeREM
- (?<=p)與:nth-child()的相似性分析
- Leetcode 19 Remove Nth Node From End of ListLeetCodeREM
- Leetcode-Remove Nth Node From End of ListLeetCodeREM
- Remove Nth Node From End of List leetcode javaREMLeetCodeJava
- HDU 1060 Leftmost Digit(數論,c++)GitC++
- :nth-child選擇器使用程式碼例項
- leetcode19:Remove Nth Node From End of ListLeetCodeREM
- POJ3187Backward Digit Sums[楊輝三角]Git