| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

PE036

Page history last edited by Kenneth Finnegan 15 years, 7 months ago

Project Euler Problem #36

 

Once I solved this problem, I was reading through the forum and realized that everyone was on crack when they were solving this.  People were converting the number into a string and converting the string.  String operations are painfully slow!!!

 

How I reversed the numbers was by pulling the first digit and putting it on a new number, then multiply the new number by 10 and divide the old, then move the next digit over, etc.  I did the same thing for binary, just with two.  This is all done in the functions rev10() and rev2().

 

Runtime: 0.056 seconds

PE036_c

 


Return to list of solutions

Comments (0)

You don't have permission to comment on this page.