GOOGLE SDE-2, CODING ROUND - 1: Find the in compatible pair of unit tests

Anonymous User
5541
Nov 21, 2023

There is a testRunner funtion that takes multiple unit test and returns if those uts are executed together & then there is some error or not. If no error then return true other wise false. You have been given N unit tests, and you know that when you run all test cases at a time then it fails. Now you need to find at least one pair of UTs, which fails when executed at the same time using the test runner.

Its easy when we assume that the testRunner takes O(1) to execute any number of test cases. But for the case when the test runner takes O(n) time to execute n test cases at a time then find the optimal way to find one pair of failed UTs.

Note there may be multiple pairs that fail with each other, but need to report only one. Also all the UTs are running ok when executed individaullay.

Any suggestion on how to solve this with optimal manner?

Comments (10)