Kindly check why it is not passing the test cases https://ide.codingblocks.com/s/225224
Alice and Totient
hello @duttrohan0302
time complexity of ur solution is high,
to optimise it precompute the totient value for all then numbers between 1 to 10^6 and store it in an array.
then answer each query in O(1).
refer this article.
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.