Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
?
I got pretty similar result ~ 3.6s
I'm stuck on 58!
theDarkBright, I just ran your solution now (twice) and it ran for 4.7 secs. Maybe server load plays a role. I ran mine also, and it runs in 0.7 secs. So there is still room for improvement. I also don't think my implementation is the most optimal one.
lol wish I saw this before I started fixing mine, cause I had the same bug.. (java)
I'm glad you figured it out & liked it.
TDRS
The description says:
4 = 2 * 2 is 2-prime since he has two prime factors (the prime 2 is not unique: 2 has multiplicity 2 since the prime 2 appears 2 times)
6 = 2 * 3 is 2-prime since he has two prime factors (2 and 3)
8 = 2 * 2 * 2 is 3-prime since 2 is prime and its multiplicity (= number of times it appears) is 3
12 = 2 * 2 * 3 is 3-prime since he has 2 prime factors (2 and 3 but 2 appears 2 times)
48 = 2 * 2 * 2 * 2 * 3 is 5-prime: 2 appears 4 times and 3 once
Note: 1 is not a prime factor because 1 is not a prime.
prime factors
, notunique prime factors
You need a
O(n)
toO(log n)
solution ;-)Old kata rankings are almost always overranked.
It is not correct.
(-1)^2 != -1^2
Its
-7^2*2
not(-7)^2*2
so the7^2
is calculated before the minus sign.Therefore,
for (char c: input.toCharArray()) ...
) are "slow" by essence (but it's possible to achieve the task if you use it only one time).EDIT: too late... x-)
Ah.
No, no can do.
Sorry.
Go to tab Solutions, and click on the button?
Loading more items...