Feature #6: Transmission Error
Implementing the "Transmission Error" feature for our "Network" project.
We'll cover the following
Description
In our network protocol, response packets take the same route (in reverse) back to the source as the request packet did to the destination. Sometimes the path may differ due to errors, and we can tolerate at most one diversion router. The path, in terms of IDs of routers along the way, is recorded in an array present inside the packet. We need to identify the paths with more than one diversion router, so our topology remains intact and transmission error occurs.
We’ll be provided with an array of integers representing the router IDs. The routers at the start and end of the path will always be the same. The first half of the array will show the request packet’s path from source to destination, while the second half will show the response packet’s path from the destination back to the source. We need to determine whether the same path is followed from source to destination and from destination to source, except for possibly one additional router ID in either the request or response packet’s paths.
The following illustration might clarify this behavior:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.