aboutsummaryrefslogtreecommitdiff
path: root/challenge-135/duncan-c-white/README
blob: 9e73de07f77ca78d1f6371e0726aaf882762c9e7 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
TASK #1 - Middle 3-digits

You are given an integer.

Write a script find out the middle 3-digits of the given integer, if
possible otherwise throw sensible error.

Example 1

  Input: $n = 1234567
  Output: 345

Example 2

  Input: $n = -123
  Output: 123

Example 3

  Input: $n = 1
  Output: too short

Example 4

  Input: $n = 10
  Output: even number of digits

MY NOTES: Pretty easy, although it's not clear how to always treat negative numbers.
Assume abs() them.


TASK #2 - Validate SEDOL

You are given 7-characters alphanumeric SEDOL.

Write a script to validate the given SEDOL. Print 1 if it is a valid SEDOL otherwise 0.

For more information about SEDOL, please checkout https://en.wikipedia.org/wiki/SEDOL

Example 1

  Input: $SEDOL = '2936921'
  Output: 1

Example 2

  Input: $SEDOL = '1234567'
  Output: 0

Example 3

  Input: $SEDOL = 'B0YBKL9'
  Output: 1

MY NOTES: Pretty easy