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.
ah yes! - all numbers are the same so array as input is wrong - my bad :-)
bad performance -> n**2
it is not right. for array like this:
arr =[]
n = 10000
for x in range(n):
arr.append(1)
arr.append(2)
arr.append(4)
-- after for finished add 1 unique in the middle
arr.append(3)
it returns 4
but is should return 3
visible test case show expected int but later it expects number string
I'm an Oracleish guy and you made my day (window functions on the same level as grouping function)
haaaha
set is unique but this is still n**2 - function is dead for 50K numbers repeated 10 times each in 500K array
timeit shows for other solutions (not the best) about 70ms avg time (which still could be improved)
set is unique but this is still n**2 - function is dead for 50K numbers repeated 10 times each in 500K array
timeit shows for other solutions (not the best) about 70ms avg time (which still could be improved)
Attempt button takes test data from "sample test" puts test data into your code and compare it with expected results.
Test Data and expected results are in "Sample Test".
If your code provides all results as expected results then you would see "Submitt" button. When you push it your code will go through series of tests, heavy tests which would verify lots of other random input and bad input, critical input etc. Full series must be finished within 16 seconds. If your code would be to slow you will get an error message "Time out"
best regards
Michal
Hi Guys,
I'm coding in Java and notice that following string should be considered as "E" (.)
"01110", "111", "000000011100000" which is somehow logical becasue I need to handle extra zeros
however in this string "000111000101010100010000000" is considered as "THE" so "000111000" in longer string is considered as T (---).
Moreover this is also considered as single "E" "1111111".
There is a rule if there is a doubt between (.) or (-) then I should choose (.) but in this case it is hard to guess.
valid point, thank you very much :-)
This comment is hidden because it contains spoiler information about the solution
ok I understand. I need to multiply all elements by others
here is a product:
[1, 1, 1, 1, 1]
1
[1, 1, 1, 2]
2
[1, 2, 2]
4
[1, 1, 3]
3
[2, 3]
6
[1, 4]
4
[5]
5
prod:
{1, 2, 3, 4, 5, 6}
Hi probably I'm missing something
if enum(5) -> [[5],[4,1],[3,2],[3,1,1],[2,2,1],[2,1,1,1],[1,1,1,1,1]].
Maybe I don't understand the goal of point:
2 - For each sub-array of enum(n) calculate its product. If n = 5 we'll obtain after removing duplicates and sorting:
Then how you can get prod(5) -> [1,2,3,4,5,6]
are you talking about number of paritions p(5) = 7
then in another example enum(8) = 22
but prod(8) -> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 16, 18]