Number of Hosts per Subnet

Given a string A representing valid subnet mask. Find the number of hosts possible.



Input Format

The only argument given is string A.

Output Format

Return the number of possible hosts.

For Example

Input 1:
    A = "255.255.248.0"
Output 1:
    2046

Input 2:
    A = "255.255.128.0"
Output 2:
    32766
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Number of Hosts per Subnet on Interview Code Editor
Sign Up
to access hints and editorial solutions for Number of Hosts per Subnet

Discussion


Loading...
Click here to start solving coding interview questions