5 kyu
Numbers with The Highest Amount of Divisors
306 of 599raulbc777
Loading description...
Fundamentals
Algorithms
Data Structures
Mathematics
Arrays
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
In the description, under "Examples", the brackets in
proc_arrInt(arr1) ------> [21, 2, [9, [36]]
are mismatched (3 opening, 2 closing).Python: Random tests are vulnerable to input modification
fixed in latest fork.
python new test framework is required. updated in this fork
Approved!
Challenging finding out the optimal solution though pretty intuitive.
again example 1:
97 isn't a member of the source array, primary 59 is
example 1 - missing a closing bracket
proc_arrInt(arr1) ------> [21, 2, [9, [36]]
C# Translation
Done +1 Thanks!
It seems like random tests sometimes pass the user arrays with duplicate numbers, and sometimes don't, but example test cases never do.
This solution passed all random tests the first time. Then when I ran it again, it failed 3 or 4 times in a row before passing again without any changes.
The cases it fails are always random and include a duplicate number in the array of most divisible numbers. ie. "expected
[ 417, 31, [ 60, [ 20592, 23184 ] ] ]
to deeply equal[ 417, 31, [ 60, [ 20592, 20592, 23184 ] ] ]
"Why is it an issue? Edit: You're right, the description sets the numbers must be different. I missed that point.
Please don't forget to say which language you are using.
Fixed in Rust, D and Javascript. Python was not affected. Ruby must be checked.
Ruby OK
Rust translation
Approved +1
Would it make more sense to return
usize
instead ofu32
for(1)
and(2)
?usize
(likesize_t
in C / C++) is a platform dependent type used for indexes and memory sizes. There is not point in using it just to count numbers.D translation
Approved + 1
Description should be language-agnostic
Maximum array length and maximum array value should be specified clearly
JS
Node 14. should be enabled
Unnecessary logs should be removed
Ruby
3.0 should be enabled
Unnecessary logs should be removed
Function and parameter name should be
snake_case
Python
New test framework should be used
The input array's length should have an upper boundary of 500 (Same as other 2 languages)
Function and parameter name should be
snake_case
fixed in latest fork.
Empty
it
blocks must be removed from tests.done.
Python: the test cases include a
primes
function, which can (and will) conflict with the users' function/variable names.Fixed (plus some minor description update)
Thanks.
Can you make this kata Python 3 compliant?
Done
Approved
Feels a little contrived.
Return value is composed of conceptually entirely different values.
Suppose you ask for two arrays, one with the numbers from the input list with the least number of divisors and one with the numbers with the most.
What rolls out is a list of primes (well, probably) and a list of highly divisible numbers.
People will probably recognise the primes, and might recognize 12, 60 and 360 as something to do with number bases or dividing circles into angles.
And the return values would be more elegantly different but similar.
That does not sound like an issue, so resolved ;-)
This is exactly an issue. This kata asks for totally different concepts: it is more an accumulation of tasks rather than a brand new mission.
I lost the count of katas where all you have to do is writing a prime checking function and there is already this kata on divisor function. This kata is redundant and I think it shouldn't have been approved.
Duplicates are reserved for things that are exact duplicates. If combining multiple tasks together is a duplicate to the individual tasks, there will not be any new katas. Everything is a combination of smaller tasks when you break them down to implement the solution. (Just think about how many times you have to write a BFS/DFS on a kata. So are they all duplicates?)
So near duplicates will never be exact duplicates, which means this kata is not a duplicate to anything (unless you can point out one, but there really isn't any).
What you said is at most an opinion (as JohanWiltink quite likes to point at people about). The correct way to express this is to vote accordingly. The "not satisfied" button is there for a reason. If you don't vote accordingly and utilize the satisfaction rating, who'll know that you don't like the kata?
I approve things that are not exact duplicates (as far as I can tell) and is functionally complete (e.g with random tests). That's it. Please utilize the satifaction system if you don't like a kata. I think the final score of
92%
is telling that as far as the people who solved this kata goes, most of them think the kata is good.Do you have a reference for that? Or are you just expressing an opinion here?
Frankly, a lot of them are.
When working on a kata, make sure to check that it has not been done already. Every new kata should ideally teach something different.
This does not talk about exact duplicates. It talks about "the concept behind a kata" instead. So sorting a list by some property of its elements is a duplicate of any kata that asks to .. well, sort a list by some property of its elements. Regardless whether that list is a newline- or space-separated string, an array, a linked list or whatever.
And yes, I get tired of actually listing duplicates, with links, sometimes. Do you remember the duplicate kata about Base-
-2
calculations? The first one was called "Skrzat" and never actually mentioned "base" or "-2". Sometimes the originals are plain unfindable. Sometimes finding the original is more work than the author of the duplicate ever invested in the duplicate kata. And sometimes finding duplicates takes all of two seconds (approved, with random tests, and with hundreds of solutions in multiple languages), but the duplicate was pushed out anyway. And eventually, it'll get approved, regardless. Because most people either don't dare or don't care to vote less than "fully satisfied", or speak their mind and raise issues and suggestions.@Voile
Please be honest: when creating new katas, combining concepts or ideas to produce a new result is essential but this kata reads as such:this_kata = [length, kata_prime, kata_divisor]
. It can't be called a combination, this is a mere concatenation of already existing katas.Also on satisfaction system, do you really think a 92%-satisfaction feedback of 12 warriors is representative of a community counting thousands of warriors?
Slight mistake in test cases for Python. lines 3 and 5 use test.describe() instead of test.assert_equals().
Thanks for your feedback aand observation. It's fixed.