Skip to content

Commit 4752b95

Browse files
author
Gonzalo Diaz
committed
[Hacker Rank] Interview Preparation Kit: Dictionaries and Hashmaps: Frequency Queries. Basic test cases added.
1 parent f851c10 commit 4752b95

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/frequency_queries_test.py

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,49 @@
1515
[2, 5],
1616
[3, 2]
1717
],
18-
'answer': [0, 1]
18+
'expected': [0, 1]
19+
},
20+
{
21+
'title': 'Sample Test Case 2',
22+
'input': [
23+
[1, 3],
24+
[2, 3],
25+
[3, 2],
26+
[1, 4],
27+
[1, 5],
28+
[1, 5],
29+
[1, 4],
30+
[3, 2],
31+
[2, 4],
32+
[3, 2]
33+
],
34+
'expected': [0, 1, 1]
35+
},
36+
{
37+
'title': 'Sample Test Case 3',
38+
'input': [
39+
[1, 3],
40+
[1, 38],
41+
[2, 1],
42+
[1, 16],
43+
[2, 1],
44+
[2, 2],
45+
[1, 64],
46+
[1, 84],
47+
[3, 1],
48+
[1, 100],
49+
[1, 10],
50+
[2, 2],
51+
[2, 1],
52+
[1, 67],
53+
[2, 2],
54+
[3, 1],
55+
[1, 99],
56+
[1, 32],
57+
[1, 58],
58+
[3, 2]
59+
],
60+
'expected': [1, 1, 0]
1961
}
2062
]
2163

@@ -27,9 +69,9 @@ def test_freq_query(self):
2769
for _, _tt in enumerate(TEST_CASES):
2870

2971
self.assertEqual(
30-
freq_query(_tt['input']), _tt['answer'],
72+
freq_query(_tt['input']), _tt['expected'],
3173
f"{_} | freq_query({_tt['input']}) must be "
32-
f"=> {_tt['answer']}")
74+
f"=> {_tt['expected']}")
3375

3476
def test_freq_query_edge_case(self):
3577

0 commit comments

Comments
 (0)