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.
BIG_DECIMAL!!!!!)
You don't have to use Integer.MAX_VALUE here.
I'm not sure about efficiency but it makes more sense to assign the variable smallest to args[0].
Im new with the programming, just want to now if i understand this correctly, getNumericValue is checking for the first char from the string and return string depending on the number?
若测试用例有2位数字的话,这个答案就不适用了
is not that obsolete since i got similar code, but I failed tests that have 2 digits.
Well... Sorry to say that, but... TESTS ARE SHIT! X-( And description isn't good either.
1
in the divisors, but not counting them as divisors (wtf!? Choose your side, man!)// I would give a 7kyu ranking..
When facing some cases like
avg. 5kyu. power avg. 6kyu.
, I am likely to prefer the former when there are many rankings(>= 10) and the latter when there are less solutions...If you say so, changed.
There are no performance requirements at all?
Then this is not
5kyu
. More like a6kyu
.This kata needs a performance version. That would be fun. :)
It seems there's a problem with the submission tests here. The last test asks for the first number with 10 factors and expects a return of 120 but if you print n it shows that it actually asks for 9 factors and and a return of 120 meaning the algorithm for solving this will return an incorrect value.
You are right. I am wrong. Apologies.
Did you try testing
)(()
on this code yourself? It should return false right after the first)
is read.This and many other apparently "best practice" solutions are just plain wrong. Only checking numbers match is not enough. Consider
)(()
- it is not balanced yet this code will say it is.i is a bad name for a variable. If used at all, it is used for an index and not for the value.
+BC from me. I like the iterating via
for (char)
instead of counting an index, but I thinktoCharArray()
is an additional copy of the input, so it comes wih a cost.Minor improvement: you could simply write
return count == 0;
which just happens to return the resulting boolean. No need for explicitly checking it for true/false here.Loading more items...