aboutsummaryrefslogtreecommitdiff
path: root/challenge-127/duncan-c-white/README
blob: bc6fe8dd99961ece1eb1f1bc84e19e2133e94685 (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
57
Task 1: "Disjoint Sets

You are given two sets with unique integers.

Write a script to figure out if they are disjoint.

The two sets are disjoint if they don't have any common members.

Example

  Input: @S1 = (1, 2, 5, 3, 4)
         @S2 = (4, 6, 7, 8, 9)
  Output: 0 as the given two sets have common member 4.

  Input: @S1 = (1, 3, 5, 7, 9)
         @S2 = (0, 2, 4, 6, 8)
  Output: 1 as the given two sets do not have common member.
"

My notes: very easy:  Intersection is not empty.


Task 2: "Conflict Intervals

You are given a list of intervals.

Write a script to find out if the current interval conflicts with any
of the previous intervals.

Example

Input: @Intervals = [ (1,4), (3,5), (6,8), (12, 13), (3,20) ]
Output: [ (3,5), (3,20) ]

    - The 1st interval (1,4) have no previous intervals to compare, skip it.
    - The 2nd interval (3,5) conflicts with previous interval (1,4).
    - The 3rd interval (6,8) does not conflict with any of the previous
      intervals (1,4) and (3,5), so skip it.
    - The 4th interval (12,13) again does not conflict with any of the
      previous intervals (1,4), (3,5) and (6,8), so skip it.
    - The 5th interval (3,20) conflicts with the first interval (1,4).

Input: @Intervals = [ (3,4), (5,7), (6,9), (10, 12), (13,15) ]
Output: [ (6,9) ]

    - The 1st interval (3,4) has no previous intervals to compare, skip it.
    - The 2nd interval (5,7) does not conflict with the previous interval
      (3,4), so skip it.
    - The 3rd interval (6,9) does conflict with one of the previous intervals
      (5,7).
    - The 4th interval (10,12) do not conflicts with any of the previous
      intervals (3,4), (5,7) and (6,9), so skip it.
    - The 5th interval (13,15) do not conflicts with any of the previous
      intervals (3,4), (5,7), (6,9) and (10,12), so skip it.
"

My notes: also looks pretty easy.  I think "conflict" means "overlap".