We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Strange Counter
Strange Counter
Sort by
recency
|
992 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch the explanation here : https://youtu.be/Plsx1i8dqiI
ini solusi tanpa looping, dengan merumuskan masalah menjadi sebuah pola
Here is my Python code!
The problem can be solved in O(1) If f(t) == 1, t = sum of geometric progression an = 3*2(n-1) . So we can find the next t where f(t) == 1