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.
Red John is Back
Red John is Back
Sort by
recency
|
145 Discussions
|
Please Login in order to post a comment
the idea in this problem is to divide the bricks into horizontal blocks and evaluate the compensation using nCr, then break the blocks down into 4 vertical bricks until reach to no horizontal block remaining, and count the combination of each loop.
To optimize the speed of nCr, we could just simplify the rule into two for loops, one for the numerator and the other for the detonatorinstead of using 3 factorials.
Also, to optimize the prime number counting, we could store the prime numbers and divide on them instead of doing a loop for all possible combinations each time.
here is my code using C language
Unravel the mystery with our promotional pencils while delving into "Red John is Back." Perfect for jotting down clues, theories, and critical details, these pencils are essential for any detective or fan of thrilling investigations. Whether you're following the latest developments or piecing together evidence, our promotional pencils ensure you stay organized and ready. Embrace the intrigue and excitement with the perfect writing tool for tracking every twist and turn in the case of Red John.
python3
Here is my solution in java, javascript, python, c ,C++, Csharp HackerRank Red John is Back Problem Solution