Serialize a data structure (map) to byte[] and convert it back (deserialize). Asked in the tech phone screen stage. Most of the prompt is points-walled; visible text mentions byte[] round-trip, and the author used Java byte streams.
Implement round_trip_map(data), which serializes a map and deserializes the resulting bytes. Keys and values are UTF-8 strings. Use a deterministic binary format: a 4-byte big-endian entry count, followed by each key and value as a 4-byte big-endian byte length and UTF-8 bytes. Return the reconstructed map.
def round_trip_map(data):