My issue
cook your dish here
t = int(input())
while(t):
n,x = map(int , input().split())
hp = input().split()
new_hp =
max_hp = int(hp[0])
for i in range(len(hp)):
if int(hp[i]) > max_hp:
max_hp = int(hp[i])
value = int(hp[i]) + (n-1) * x
new_hp.append(value)
min_new_hp = min(new_hp)
least_value = min_new_hp if min_new_hp > max_hp else max_hp
print(least_value)
t -= 1
tell why this code fail to submit all test cases
My code
# cook your dish here
t = int(input())
while(t):
n,x = map(int , input().split())
hp = input().split()
new_hp = []
max_hp = int(hp[0])
for i in range(len(hp)):
if int(hp[i]) > max_hp:
max_hp = int(hp[i])
value = int(hp[i]) + (n-1) * x
new_hp.append(value)
min_new_hp = min(new_hp)
least_value = min_new_hp if min_new_hp > max_hp else max_hp
print(least_value)
t -= 1
Problem Link: Monster Monster Practice Coding Problem