¡@

Home 

c++ Programming Glossary: numheavy

Interview Question: Optimal Solution to the problem of finding Heavy integers

http://stackoverflow.com/questions/7136590/interview-question-optimal-solution-to-the-problem-of-finding-heavy-integers

size_t compute_heavy_naive size_t start size_t end size_t numHeavy 0 size_t numDigits 0 unused here printf n Naive heavy numbers.. i if digit_sum i numDigits HEAVY_AVG numDigits cout i numHeavy printf n Naive digit_sum computed d times and total heavy numbers.. computed d times and total heavy numbers d n end start 1 numHeavy return numHeavy A optimal approach size_t compute_heavy_optimal..