LOCKER - Magic of the locker
My Solution (EDIT : SOLVED IT)
Hi, I have already been through the discussions on this question…can’t reach an AC tho!!
- for 0 ans is 1
- for 1 ans is 1.
- any other number n … count the no. of 3s by d = (n/3) and remainder rem = (n%3) then if rem is 1 then increase rem by 3 , decrease d by 1 …for final answer… raised 3^d and multiply with rem.
PS: This is my first time asking a doubt … I don’t know if i’m allowed to xplain my approach.Any test case where my code fails will also help. Thank you.