Daily Challenge (162 Part Series)
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("220.127.116.11", "18.104.22.168") => 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 firstname.lastname@example.org with your suggestions!