mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-04 00:18:02 +00:00
Add longest substr k distinct challenge
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from nose.tools import assert_equal, assert_raises
|
||||
|
||||
|
||||
class TestSolution(object):
|
||||
|
||||
def test_longest_substr(self):
|
||||
solution = Solution()
|
||||
assert_raises(TypeError, solution.longest_substr, None)
|
||||
assert_equal(solution.longest_substr('', k=3), 0)
|
||||
assert_equal(solution.longest_substr('abcabcdefgghiij', k=3), 6)
|
||||
assert_equal(solution.longest_substr('abcabcdefgghighij', k=3), 7)
|
||||
print('Success: test_longest_substr')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestSolution()
|
||||
test.test_longest_substr()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user