kyu_7.find_the_longest_gap package
Submodules
kyu_7.find_the_longest_gap.gap module
Solution for -> Find the longest gap!.
Created by Egor Kostan. GitHub: https://github.com/ikostan
- kyu_7.find_the_longest_gap.gap.calc_g_cur(g_cur: int, char: str) int[source]
Calculate g_cur.
- Parameters:
g_cur
char
- Returns:
kyu_7.find_the_longest_gap.test_gap module
Test for -> Find the longest gap!.
Created by Egor Kostan. GitHub: https://github.com/ikostan
- class kyu_7.find_the_longest_gap.test_gap.GapTestCase(methodName='runTest')[source]
Bases:
TestCaseTesting gap function.
- _classSetupFailed = False
- _class_cleanups = []
- test_gap = None
- test_gap_0(**kw)
Testing gap function with various test inputs [with num=9, expected=2].
A binary gap within a positive number num is any sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of num.
The gap function should return the length of its longest binary gap.
The function should return 0 if num doesn’t contain a binary gap. :return:
- test_gap_1(**kw)
Testing gap function with various test inputs [with num=529, expected=4].
A binary gap within a positive number num is any sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of num.
The gap function should return the length of its longest binary gap.
The function should return 0 if num doesn’t contain a binary gap. :return:
- test_gap_2(**kw)
Testing gap function with various test inputs [with num=20, expected=1].
A binary gap within a positive number num is any sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of num.
The gap function should return the length of its longest binary gap.
The function should return 0 if num doesn’t contain a binary gap. :return:
- test_gap_3(**kw)
Testing gap function with various test inputs [with num=15, expected=0].
A binary gap within a positive number num is any sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of num.
The gap function should return the length of its longest binary gap.
The function should return 0 if num doesn’t contain a binary gap. :return:
Module contents
Find the longest gap.