please check my submission and help.
Firstly, dont straightaway jump for coding. Think on the question first. Like, is it possible for array to have product of all its elements if 2 or more numbers are more than 1 or less than -1??
Secondly, an array of size n=1 is always beautiful by definition.
Thirdly, you are suffering from overflow error here, check the cosntraints and data range data-types like int, long long etc.
Fourthly, even when you correct this code from overflow, you will get TLE. If you are a beginner, then this question isnt recommended right now. Try with a more easier question to get comfortable with your programming language.
i did what was given in the question.
i did not understood your 1s point.
You did what was asked in the question, and did not pay any heed to time limit. Just tell me, if i give you a question to add all numbers from 1 to N and return the sum, will you actually make a loop iterating from 1 to N and add each number indiviually? Or will you use a clever approach and simply sue formula Sum=N(N+1)/2 and save time?
Often if you just tackle Q head-on, you are bound to get TLE.
BTW, you didnt comment about other points, i hope you understood them.