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.
Having solved the problem recursively,but on my first attempt,my program got Terminated Due to Timeout because I don't record the result using map in C++.
After recording the result of each number visited,it got accepted.
Could anyone prove why just recording the result can make the time complexity right?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #169: Exploring the number of different ways a number can be expressed as a sum of powers of 2.
You are viewing a single comment's thread. Return to all comments →
Having solved the problem recursively,but on my first attempt,my program got Terminated Due to Timeout because I don't record the result using map in C++. After recording the result of each number visited,it got accepted. Could anyone prove why just recording the result can make the time complexity right?