Gave phone screen interview today.
You are tasked with detecting all devices on the network which are below the acceptable version number, so that a report can be created on network health and appropriate cleanup steps can be taken. As the first step in this project, you are tasked with returning all IPs in a given range.
Example 1:
Input: start = "192.168.0.254", end = "192.168.1.2"
Output: ["192.168.0.254", "192.168.0.255", "192.168.1.0", "192.168.1.1", "192.168.1.2"]Example 2:
Input start ="0.0.0.0", end = "255.255.255.255"
Output: ["0.0.0.0", "0.0.0.1", ..., "0.0.0.255", "0.0.1.0", ... "0.0.1.255", "0.0.2.0", ... "0.0.255.255", "0.1.0.0" ... "255.255.255.255"]Example 3:
Input: start = "1.1.255.255", end = "1.2.0.1"
Output: "[1.1.255.255", "1.2.0.0", "1.2.0.1"]I tried iterative approach with backtracking but could not convince the interviewer.