1. How to implement Array#compact shortest way
2. 22520 - the smallest number which is dividing on all number from 1 till 10 without remainders. Which number are dividing without remainders from 1 till 20?
3. The sum of all natural numbers till 10, which is dividing on 3 or 5 is 23. What is the sum all natural numbers smaller then 1000
4. a and b - arrays. Junior developer has written
a = a+b
a.uniq!
How to refactor this code?
5. Write latest 10 digits of 1^1 + 2^2 + 3^3 ... 1000^1000
Todo. Examples of solutions
1. a-[p]. Correct answer is a-[nil] also. But 'p' it's a puts variable and it returns nil!
2. 232792560
3. 233168
4. a |= b
5. 9110846700
habrahabr.ru
Comments
Post a Comment