1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
Challenge 1: "Create a script that prints nth order forward difference
series. You should be a able to pass the list of numbers and order number
as command line parameters. Let me show you with an example:
Suppose we have list (X) of numbers: 5, 9, 2, 8, 1, 6 and we would like
to create 1st order forward difference series (Y). So using the formula
Y(i) = X(i+1) - X(i), we get the following numbers: (9-5), (2-9), (8-2),
(1-8), (6-1), ie 4, -7, 6, -7, 5.
If you noticed, it has one less number than the original series.
Similarly you can generate the 2nd order forward difference series like:
(-7-4), (6+7), (-7-6), (5+7) => -11, 13, -13, 12.
My notes: Clearly defined, very easy - let's have a go..
Challenge 2: "Create a script that prints Prime Decomposition of a
given number. The prime decomposition of a number is defined as a list
of prime numbers which when all multiplied together, are equal to that
number. For example, the Prime decomposition of 228 is 2,2,3,19 as 228 =
2 * 2 * 3 * 19."
My notes: So, prime factors then. Very easy again. In fact, haven't I
already solved this in one of the other prime-based questions?
Challenge 3: "Write a script to use Random Poems API:
https://www.poemist.com/api/v1/randompoems
This is the easiset API, I have come across so far. You don't need API
key for this. They have only route to work with (GET). The API task is
optional but we would love to see your solution."
My notes: ok, even I can't argue that obtaining an API key for an API
I will literally never use again is too much hassle - when I don't need
an API key, and the whole program appears to be an LWP::Simple get..
update: well, apart from the Unicode in the response, complicating life.
|