Here's a link to the problem - 
https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ffc7/00000000001d3f56

Here's my patched up approach - 

T = int(input())

for t in range(T) :
    N, B = map(int, input().split())
    A = sorted(list(map(int, input().split()))[:N])

    sum = y = 0

    while sum <= B:
        if y == N:
            break
        sum = sum + A[y]
        if sum <= B:
            y = y+1

    print("Case #{}: {}".format(t+1, y)) 
   

   


*Question - *

   - How to make this code *more* *Pythonic* (a.k.a shorter and simpler to 
   understand) and *more efficient ?*


 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/6509249a-c604-484d-b52d-b557e44679f8%40googlegroups.com.

Reply via email to