-
-
Notifications
You must be signed in to change notification settings - Fork 547
/
Copy pathcanonical-data.json
146 lines (146 loc) · 3.84 KB
/
canonical-data.json
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
"exercise": "change",
"comments": [
"Given an infinite supply of coins with different values, ",
"find the smallest number of coins needed to make a desired ",
"amount of change."
],
"cases": [
{
"uuid": "d0ebd0e1-9d27-4609-a654-df5c0ba1d83a",
"description": "change for 1 cent",
"property": "findFewestCoins",
"input": {
"coins": [1, 5, 10, 25],
"target": 1
},
"expected": [1]
},
{
"uuid": "36887bea-7f92-4a9c-b0cc-c0e886b3ecc8",
"description": "single coin change",
"property": "findFewestCoins",
"input": {
"coins": [1, 5, 10, 25, 100],
"target": 25
},
"expected": [25]
},
{
"uuid": "cef21ccc-0811-4e6e-af44-f011e7eab6c6",
"description": "multiple coin change",
"property": "findFewestCoins",
"input": {
"coins": [1, 5, 10, 25, 100],
"target": 15
},
"expected": [5, 10]
},
{
"uuid": "d60952bc-0c1a-4571-bf0c-41be72690cb3",
"description": "change with Lilliputian Coins",
"property": "findFewestCoins",
"input": {
"coins": [1, 4, 15, 20, 50],
"target": 23
},
"expected": [4, 4, 15]
},
{
"uuid": "408390b9-fafa-4bb9-b608-ffe6036edb6c",
"description": "change with Lower Elbonia Coins",
"property": "findFewestCoins",
"input": {
"coins": [1, 5, 10, 21, 25],
"target": 63
},
"expected": [21, 21, 21]
},
{
"uuid": "7421a4cb-1c48-4bf9-99c7-7f049689132f",
"description": "large target values",
"property": "findFewestCoins",
"input": {
"coins": [1, 2, 5, 10, 20, 50, 100],
"target": 999
},
"expected": [2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100]
},
{
"uuid": "f79d2e9b-0ae3-4d6a-bb58-dc978b0dba28",
"description": "possible change without unit coins available",
"property": "findFewestCoins",
"input": {
"coins": [2, 5, 10, 20, 50],
"target": 21
},
"expected": [2, 2, 2, 5, 10]
},
{
"uuid": "9a166411-d35d-4f7f-a007-6724ac266178",
"description": "another possible change without unit coins available",
"property": "findFewestCoins",
"input": {
"coins": [4, 5],
"target": 27
},
"expected": [4, 4, 4, 5, 5, 5]
},
{
"uuid": "ce0f80d5-51c3-469d-818c-3e69dbd25f75",
"description": "a greedy approach is not optimal",
"property": "findFewestCoins",
"input": {
"coins": [1, 10, 11],
"target": 20
},
"expected": [10, 10]
},
{
"uuid": "bbbcc154-e9e9-4209-a4db-dd6d81ec26bb",
"description": "no coins make 0 change",
"property": "findFewestCoins",
"input": {
"coins": [1, 5, 10, 21, 25],
"target": 0
},
"expected": []
},
{
"uuid": "c8b81d5a-49bd-4b61-af73-8ee5383a2ce1",
"description": "error testing for change smaller than the smallest of coins",
"property": "findFewestCoins",
"input": {
"coins": [5, 10],
"target": 3
},
"expected": {
"error": "can't make target with given coins"
}
},
{
"uuid": "3c43e3e4-63f9-46ac-9476-a67516e98f68",
"description": "error if no combination can add up to target",
"property": "findFewestCoins",
"input": {
"coins": [5, 10],
"target": 94
},
"expected": {
"error": "can't make target with given coins"
}
},
{
"uuid": "8fe1f076-9b2d-4f44-89fe-8a6ccd63c8f3",
"description": "cannot find negative change values",
"property": "findFewestCoins",
"input": {
"coins": [1, 2, 5],
"target": -5
},
"expected": {
"error": "target can't be negative"
}
}
]
}