• + 0 comments

    Test case 2, 3 and 15 fails with this code. Can anyone maybe check where I went wrong?

    def solve(n, k): # Write your code here # math. ceil() first_k = k end = False count = 1 summation = 0 while(not end): x = 0 incr = 0 if (kn):

            x = int(math.ceil(((k/2)+0.5)))
            if (x>n):
                end = True    
            else:
                incr = n - x + 1
                summation = summation + incr
                if (incr==1):
                    end = True        
        elif (k==n):
            end = True   
        count = count + 1
        k = k + first_k
    return summation