Google | Phone screen round | L3 Level

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2024-10-10Added By Anonymous
Source: Link
🧭 Experience: unknown
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown

You have N unit tests that pass if run separately. But there are several pairs of tests that, if run in a single test set, fail the whole set (e.g. because they modify a global state in a non-hermetic db). Your task is to find any such pair.

You are given a function runTests(il, i2, 13, ) that takes a subset of tests, executes them in a single set and returns true if the whole set passes.

You can also assume that all minimal sets of tests that fail are made up of a pair of tests
(i.e. if runTests(s) fails, with len(s) > 2, then there exists a strict subset t of s such that runTests (t) also fails).

Can someone please help to get the approach better than O(N^2)
Note - runTests(s) this function also have a complexity = len(s)
Comments