0

Failed many test cases

I'd got this question in an interview but it failed many test cases. It was to print true if sum of array elements equals the max element in the array. Include negative elements ans and elements can be repeated. Can anyone tell me what I did wrong??? https://code.sololearn.com/cJB7m79xMjqV/?ref=app

23rd Jun 2022, 4:35 PM
Vkd
Vkd - avatar
3 Answers
+ 3
Vkd Program is right but I think you just have to print True or False nothing else
23rd Jun 2022, 4:43 PM
A͢J
A͢J - avatar
+ 2
Vkd Always remember test cases only needs final output because if test case output is "xyz" and you print "abc" and "xyz" then test cases would not be match. So you just have to print "xyz" In this case you have printed sum which is not in test cases.
24th Jun 2022, 5:49 AM
A͢J
A͢J - avatar
+ 1
Oh, I literally printed the sum... yikes that cost me an interview
24th Jun 2022, 3:50 AM
Vkd
Vkd - avatar