Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Nitin Varun
Incorrect Test Case Validation.

Nitin Varun

Mar 1, 2024

Hi Team, Please validate if test cases used for accepting solution is correct or not. For example, In below particular test case.

[5,3] -> 8 and [5,2] -> 7 must be one of acceptable solution because both produces top 2 max sum pair.

Expected Output also produces top 2 max pair sum which is 8 and 7.

Please help in adding more valid test case scenario for accepting the solution.

————————————————-

L1 = [5, 4, 3]

L2 = [3, 2, 1]

K = 2

Output[[5,3],[5,2]]

Expected[[5,3],[4,3]]

—————————————————-

6

0

Comments
Comments
Design Gurus
Design Gurus2 years ago

You are right. Both outputs are valid. We have updated the test case.

Z
zachery.pang 2 years ago

Your Input:

[5, 3, 1]

[4, 2, 0]

5

Output:

[[1,4],[5,0],[5,2],[5,4],[3,4]]

Expected:

[[5,4],[5,2],[3,4],[3,2],[1,4]]

This test case is failing as well even though [5, 0] and [3, 2] both sum to 5

Z
zachery.pang 2 years ago

Your Input:

[10, 8, 6]

[9, 7, 5]

2

Output:

[[10,7],[10,9]]

Expected:

[[8,9],[10,9]]

This test case is failing as well. [10, 7] and [8, 9] both give 17

On this page