34
3
You are given three parameters: start(int), end(int) and list(of int);
Make a function that returns the amount of times all the numbers between start and end are multiples of the elements in the list. example:
start = 15; end = 18; list = [2, 4, 3];
15 => 1 (is multiple of 3)
16 => 2 (is multiple of 2 and 4)
17 => 0
18 => 2 (is multiple of 2 and 3)
result = 5
The function should accept two positive integer numbers and an array of integers as parameters, returning the total integer number. Assume that start is less <= end.
examples:
Multiple(1, 10, [1, 2]); => 15
Multiple(1, 800, [7, 8]); => 214
Multiple(301, 5000,[13, 5]); => 1301
The shortest solution is the victor!!! May he odds be ever in your favor...
8Nice challenge! Presumably the winning criterion is shortest code? In which case you should say so explicitly, and add the [tag:code-golf] tag. – Robin Ryder – 2019-12-02T10:16:44.887
9Can we assume that
start
will always be less thanend
? – Galen Ivanov – 2019-12-02T11:49:28.517You say integers. So
start
,end
or the elements inlist
may be non-positive? – Seb – 2019-12-03T11:17:53.697Thanks for the feedback, I was lacking that in the problem. – Rui Silva – 2019-12-03T14:43:48.607
I'd like to ask a question (as I'm really new in this channel), how do I decide the winner? since each language has it's own limitations... Or is it simply a personal preference? – Rui Silva – 2019-12-06T08:52:01.907