aboutsummaryrefslogtreecommitdiff
path: root/challenge-124/duncan-c-white/README
blob: ab825e9e01d05a3d664148f13f20217b7b3160b2 (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
Task 1: "Write a script to print the Venus Symbol, international gender
symbol for women. Please feel free to use any character.

    ^^^^^
   ^     ^
  ^       ^
 ^         ^
 ^         ^
 ^         ^
 ^         ^
 ^         ^
  ^       ^
   ^     ^
    ^^^^^
      ^
      ^
      ^
    ^^^^^
      ^
      ^
"

My notes: sounds like a print statement to reproduce the given input.


Task 2: "Tug of War

You are given a set of $n integers (n1, n2, n3, ...).

Write a script to divide the set in two subsets of n/2 sizes each so
that the difference of the sum of two subsets is the least. If $n is
even then each subset must be of size $n/2 each. In case $n is odd then
one subset must be ($n-1)/2 and other must be ($n+1)/2.

Example

  Input:        Set = (10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
  Output:  Subset 1 = (30, 40, 60, 70, 80)
           Subset 2 = (10, 20, 50, 90, 100)

  Input:        Set = (10, -15, 20, 30, -25, 0, 5, 40, -5)
           Subset 1 = (30, 0, 5, -5)
           Subset 2 = (10, -15, 20, -25, 40)
"

My notes: sounds like a "generate and test" problem.  Easy to do inefficiently,
	  challenging to try to make efficient.
	  Let's start by counting from 0 to 2^n-1 and using the bits
	  to select which subset to put each value into.