Smallest product of three numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Smallest product of three numbers

Hello I have recently attempted one test In that test. The question is The program must accept N integers as the input .The program must print the smallest value obtained by multiplying three integers among N integers as the output. -3<=N<=1000 -1000<=Each integer<=1000 Testcases are: 5 -5 3 12 5 7 Output -420 #My code is N=int(input()) arr=list(map(int,input().split())) arr.sort() if(arr[0]<0): print(arr[0]*arr[-2]*arr[-1] else: print(arr[0]*arr[1]*arr[2]) For this code only 6 testcases are passed out of 8 test cases. could you please help me what could be the other test cases.

2nd Sep 2020, 5:28 AM
Varshith
Varshith - avatar
2 Answers
+ 6
Voleti Varshith Check for this condition [-6,-7,-3,13]
2nd Sep 2020, 1:28 PM
Ajith
Ajith - avatar
0
Thank you Ajith
2nd Sep 2020, 1:35 PM
Varshith
Varshith - avatar