Skip to content

Commit 73f4394

Browse files
stkentInsti
authored andcommitted
saddle-points: add canonical data (#756)
1 parent 4a2a99e commit 73f4394

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"exercise": "saddle-points",
3+
"version": "1.0.0",
4+
"comments": [
5+
"Matrix rows and columns are 0-indexed."
6+
],
7+
"cases": [
8+
{
9+
"description": "Can identify single saddle point",
10+
"comments": [
11+
"This is the README example."
12+
],
13+
"property": "saddlePoints",
14+
"input": [
15+
[9, 8, 7],
16+
[5, 3, 2],
17+
[6, 6, 7]
18+
],
19+
"expected": [
20+
{
21+
"row": 1,
22+
"column": 0
23+
}
24+
]
25+
},
26+
{
27+
"description": "Can identify that empty matrix has no saddle points",
28+
"property": "saddlePoints",
29+
"input": [
30+
[]
31+
],
32+
"expected": []
33+
},
34+
{
35+
"description": "Can identify lack of saddle points when there are none",
36+
"property": "saddlePoints",
37+
"input": [
38+
[1, 2, 3],
39+
[3, 1, 2],
40+
[2, 3, 1]
41+
],
42+
"expected": []
43+
},
44+
{
45+
"description": "Can identify multiple saddle points",
46+
"property": "saddlePoints",
47+
"input": [
48+
[4, 5, 4],
49+
[3, 5, 5],
50+
[1, 5, 4]
51+
],
52+
"expected": [
53+
{
54+
"row": 0,
55+
"column": 1
56+
},
57+
{
58+
"row": 1,
59+
"column": 1
60+
},
61+
{
62+
"row": 2,
63+
"column": 1
64+
}
65+
]
66+
},
67+
{
68+
"description": "Can identify saddle point in bottom right corner",
69+
"comments": [
70+
"This is a permutation of the README matrix designed to test",
71+
"off-by-one errors."
72+
],
73+
"property": "saddlePoints",
74+
"input": [
75+
[8, 7, 9],
76+
[6, 7, 6],
77+
[3, 2, 5]
78+
],
79+
"expected": [
80+
{
81+
"row": 2,
82+
"column": 2
83+
}
84+
]
85+
}
86+
]
87+
}

0 commit comments

Comments
 (0)