FrankKair / polyglot-euler

📜 Project Euler solutions in various programming languages
MIT License
73 stars 14 forks source link

Swift 003 008 #90

Closed cesarbess closed 6 years ago

cesarbess commented 6 years ago

✅ I checked CONTRIBUTING.md for my programming language of choice.

How the solution works

003 Uses two Int extension functions to get the factors of a number, filters the prime ones and takes the largest number of them

008 Maps each String character into a Int, then multiplies each consecutive sub-collections with size 13 and gets the biggest result from them

Performance

003

Real time: 1.016 s
User time: 0.858 s
Sys. time: 0.144 s
CPU share: 98.66 %

008

Real time: 0.575 s
User time: 0.468 s
Sys. time: 0.099 s
CPU share: 98.68 %