Panda Guru LogoPanda
Guru

How to do this google interview question

Round 1

Questions: We were tasked with writing a function to compute the "set" difference between two ranges of floating-point numbers. The solution needed to return the values in the first range that are not in the second range.

For example:

a: [2.5, 7.5), b: [4.3, 9.3) → Answer: [2.5, 4.3)
a1: [2.5, 9.5), b1: [4.5, 6.5) → We were asked to implement the function.

Question 2: What would change if the ranges were sorted and non-overlapping? The solution required adjusting the approach to handle multiple sorted ranges.

For example:

a: [2.5, 7.5), [9.0, 10.4), b: [4.3, 9.3), [9.5, 11.0) → Answer: [2.5, 4.3), [9.3, 9.5)

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.