Wednesday, July 4, 2012

Project Euler Problem 8

Peace. Yay, solved another today. My head feels a lot clearer to do this. This is like, consecutive winning for several days. xD. What I had in mind was to create a subset of 5 digits which will be multiplied with each others. The greatest product will be stored. But, this required us to do several steps:

  1. Split the string to 5 characters (well, the 5 digits as per the question)
  2. Change to integers
  3. Get the products of those 5 digits
  4. Compare the largest product and current product
  5. Display the largest product at the end
Certain conditions that I can put in as I read around the Internet websites are "If it involves digit 0, skip to next as the product will always be 0" and "Iteration can be reduced by 4 as I already reach the last 5 digits" (this explained the i-4 thingy in my for loop ).

Tuesday, July 3, 2012

Project Euler Problem 7

Peace. Solved another problem in project euler today. I may not do it by myself, rather having some references from internet, but I feel satisfied in solving 7th problem today within an hour or so. I still have long way to go, but the great feeling of achievement even from small thing really matter to me.