Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 370b2b29a6
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (25 sloc) 1.116 kb

IPv6 Problem

Given an inclusive contiguous range of positive integerers between a and b and a list of lists where each sublist contains integers that are within the range, how many integers between a and b do not exist in any of the lists.

For example:

    Start = 0
    End = 9
    Lists = [[1,2,3], [2,3,4]]

The integers that do not occur in Lists are 0, 5, 6, 7, 8, and 9, so there are 6 integers that do not exist in Lists that satisfy Start <= n <= End.

Write a function to determine how many numbers are 'used' and how many are 'unused'. (Hint, calculate unused)

Beware: Start can be small and End can be very large (the range may be larger than you would want to itterate over).

Rules:

* You cannot merge any two lists (do everything inplace)

Make the tests pass

There is a file called calc_usage in this directory with a method header. Implement the method. You can run the tests by doing python usage_tests.py. If you want to run a specific test you can do: python -m unittest usage_tests.UsageTests.<nameOfTheTest>

Jump to Line
Something went wrong with that request. Please try again.