You are viewing a single comment's thread. Return to all comments →
Can someone find whats wrong with my code?
#!/bin/python3 import sys t = int(input().strip()) for a0 in range(t): n,k = input().strip().split(' ') n,k = [int(n),int(k)] num = input().strip() # prefix array marr = [int(num[0])] for i in range(1,len(num)): marr.append(marr[-1](int(num[i]))) #print(marr) res = 0 #find max prodcut for i in range(k,len(marr)): if marr[i-k] !=0: prod = marr[i]//marr[i-k] res=max(prod , res ) res = max(res,marr[k-1]) print(res)
*
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #8: Largest product in a series
You are viewing a single comment's thread. Return to all comments →
Can someone find whats wrong with my code?
*