This problem has a simple O(1) solution:
n*(n+1)/2 = floor. solve for n
If floor = 100, n = 14
PS: Account for the rounding of the inequality solution
What I don't understand is, why is G(0) = 1?
@GreenTea211 The complexity O(n) where n is the length - aka the number of digits IS EQUAL to O(lgn) where n is the number itself.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.