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.
Also, if you use a larger primes array (eg Primes from 2 to 59 or greater), you will also fail test cases 11, 16, 17.
tl;dr - In Java 8, passing all test cases is dependent on using Primes array from 2 to 53. You will faile test cases 11,16 and 17 using other array constituents.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Leonardo's Prime Factors
You are viewing a single comment's thread. Return to all comments →
Interesting problem. Although I would add that you do have to experiement with the primes array (at least in Java 8) to pass all test cases.
The below function passes all test cases - including the troublesome 11, 16 and 17.
Note that if you use the below primes array, you will fail 11, 16 and 17.
Also, if you use a larger primes array (eg Primes from 2 to 59 or greater), you will also fail test cases 11, 16, 17.
tl;dr - In Java 8, passing all test cases is dependent on using Primes array from 2 to 53. You will faile test cases 11,16 and 17 using other array constituents.