Your challenge is to write a function that accepts starting and ending IPv4 addresses and returns the number of IP addresses from start to end, excluding the ending address. All input will be valid IPv4 addresses in the forms of strings.
ipsBetween("10.0.0.0", "10.0.0.50") => 50
ipsBetween("10.0.0.0", "10.0.1.0") => 256
ipsBetween("188.8.131.52", "184.108.40.206") => 246
It would be impressive if anyone wanted to try their hand at creating the same function for IPv6. You might have to work with some hefty numbers though.
Good luck, happy coding!
This challenge comes from user xDranik. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge for a future post? Email email@example.com with your suggestions!