google interview
Anonymous User
136

Below is the coding question can anyone solve it
/*

  • We have regular data transmission sessions from a Martian probe and the Earth.
  • There are 2 channels A & B handled by 2 geographically distributed Earth-side
  • receivers, and the same data is being sent on both channels (it's mirrored).
  • Due to a lightspeed delay of many minutes, the data is being sent in a blind.
  • And both channels are somewhat lossy. Both earthly receivers produce logs of
  • the ranges of data frame numbers they have successfully received, the frames
  • are numbered sequentially and the ranges are reported in order, for example
  • [0, 20), [40, 90), …. Note that each receiver produces its own list!
  • We want to produce a list of holes in the data, so it could be transmitted
  • back to the probe to execute the retry, but only for the frames missing in
  • both channels at once (interplanetary data channel time is precious, so we
  • don't want to send something which was already successfully received on any of
  • the receiving stations).
  • Write a function producing the holes report based on both reported per-channel
  • sequences of ranges.
    */

A:-[(0,20),(40,90),(150,160)]
B:-[(0,20),(50,60),()]

output:-((20,40),(90,150))

Comments (2)