Project Euler #164: Numbers for which no three consecutive digits have a sum greater than a given value.

Sort by

recency

|

25 Discussions

|

  • + 1 comment

    Is there a chance project euler problems in Hackerrank can be improved? You can increase the limit to M <= 50000 to allow a more optimized version to be advantageous :D

  • + 0 comments

    can someone please explain me the problem statement in simple language?

  • + 0 comments

    Can anyone help me. My answers are coming when m < 7 but not for greater than 7. It gives timeout error. Here is my code in python2

    m = int(input())
    for i in range(0,m):
        if i==0:
            ll = str(1)
            ul = str(9)
        else:
            ll = ll + str(0)
            ul = ul + str(9)
    ll = int(ll)
    ul = int(ul)
    
    count = 0
    i = ll
    while i <= ul:
        numlist = [int(j) for j in str(i)]
        k = 3
        l = 0
        flag = 0
        while k <= len(numlist):
            if sum(numlist[l:k]) > 9:
                flag = 1
                break
            l = l + 1
            k = k + 1    
        if flag == 0:
            count = count + 1
        i = i + 1
    print count
    
  • + 0 comments

    Simple digit dp problem. Constraints on M are very less. Can be upto 1 million according to my solution.

  • + 2 comments

    I have solved The problem but I am having problem to print Answer Modulo 10^9+7. It is coming into the range of double.That is why % operator is not working sice it is a binary operand. Please help me