Also can you please tell me the value of the constraint after which i have to take a long int instead of an int and the value of the time complexity upto which a solution in
i) O(n) works
ii) O(n^2) works
iii) O(n^3) works
Output is correct but test cases are failing
see basically u have to long int when ur ans goes beyond 10^9…
rest for complexity it depends on ques to ques… u can refer to this code https://ide.codingblocks.com/s/605229
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.