m,n should be non-negative integers, the function should return null (Javascript), None (Python), or nil (Ruby) for other type, non-integer and negative numbers.

You also have to remember that this is codewars. If the code needed to be time critical, the tests would reflect that. Speaking of which, if your code needs to be time critical in the real world, Python isn't the language for you, otherwise it's good enough for most jobs ;)

Counter(arr).items() returns a list of [(key1, value1), (key2, value2), ...] where the keys are the distinct numbers in arr and the values are the occurrences of that key in arr. You can pass this into the max function with a custom key to retrieve the max value. The key takes in a (key, value) instance and compares it against other elements by first comparing x[1] then x[0] where x[1] is the occurrence of that number and x[0] is the number as stated before. You need to apply [0] to the outputted (key,value) of the max function to obtain the distinct number.

Nice but you are counting every digit regardless if it is in digits_list. Not too important but would speed up your solution for large integers_list and small digits_list.

At year 1: f0=10000

At year 2: f1=10000-10000=0

Therefore at the end of year 2 John still has a non-negative amount on money.

This would occur if n is a single digit number, because the product of all the digis in a single digit number is that number.

Instead of this:

perhaps use this:

Done. Is it good?

Not tested in javascript.

This is a 6 kyu? You are basically given the program in the description.

`check_prime`

function could be improved vastly, check out Blind4Basics solution for inspiration.I would not consider this the best solution since this problem can be solved in

`O(1)`

.I agree,

`field.index(subfield)`

adds an extra loop that is not necessarily needed.You also have to remember that this is codewars. If the code needed to be time critical, the tests would reflect that. Speaking of which, if your code needs to be time critical in the real world, Python isn't the language for you, otherwise it's good enough for most jobs ;)

`Counter(arr).items()`

returns a list of`[(key1, value1), (key2, value2), ...]`

where the keys are the distinct numbers in`arr`

and the values are the occurrences of that key in`arr`

. You can pass this into the`max`

function with a custom`key`

to retrieve the max value. The key takes in a`(key, value)`

instance and compares it against other elements by first comparing`x[1]`

then`x[0]`

where`x[1]`

is the occurrence of that number and`x[0]`

is the number as stated before. You need to apply`[0]`

to the outputted`(key,value)`

of the max function to obtain the distinct number.This comment is hidden because it contains spoiler information about the solution

This comment is hidden because it contains spoiler information about the solution

Better safe than sorry I guess. In this kata it is not needed however.

Nice but you are counting every digit regardless if it is in digits_list. Not too important but would speed up your solution for large integers_list and small digits_list.

## Loading more items...