Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 588 Bytes

(5 kyu) Count IP Addresses.md

File metadata and controls

15 lines (10 loc) · 588 Bytes

Count IP Addresses (5 kyu)

https://www.codewars.com/kata/526989a41034285187000de4

Write a function that accepts a starting and ending IPv4 address, and returns the number of IP addresses from start to end, excluding the end IP address.

All input to the ipsBetween function will be valid IPv4 addresses in the form of strings. The ending address will be at least one address higher than the starting address.

Examples:

ipsBetween("10.0.0.0", "10.0.0.50") => returns 50
ipsBetween("10.0.0.0", "10.0.1.0") => returns 256
ipsBetween("20.0.0.10", "20.0.1.0") => returns 246