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.
- Prepare
- Mathematics
- Algebra
- Sherlock and Square
- Discussions
Sherlock and Square
Sherlock and Square
Sort by
recency
|
6 Discussions
|
Please Login in order to post a comment
return (pow(2,n+1,1000000007)+2)%1000000007
My normal solution
https://github.com/joy-mollick/Problem-Solving-Solutions-Math-Greedy-/blob/master/HackerRank-Sherlock%20and%20Square.cpp
the trick is to use a custom code for power generation
Is there any problem with the logic?
can anyone tell me why am I getting termination due to timeout for the following code
is there a way to do it even faster