mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Fix #13, PEP8-ify notebooks.
This commit is contained in:
parent
03f04fbc4c
commit
235b6c5abe
|
@ -36,7 +36,6 @@
|
|||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"See the [HackerRank problem page](https://www.hackerrank.com/challenges/maximizing-xor)."
|
||||
]
|
||||
},
|
||||
|
@ -105,10 +104,12 @@
|
|||
" assert_equal(max_xor(10, 15), 7)\n",
|
||||
" print('Success: test_maximizing_xor')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestMaximingXor()\n",
|
||||
" test.test_maximizing_xor()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"See the [HackerRank problem page](https://www.hackerrank.com/challenges/maximizing-xor)."
|
||||
]
|
||||
},
|
||||
|
@ -124,10 +123,12 @@
|
|||
" assert_equal(max_xor(10, 15), 7)\n",
|
||||
" print('Success: test_maximizing_xor')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestMaximingXor()\n",
|
||||
" test.test_maximizing_xor()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
|
|
@ -7,9 +7,11 @@ class TestMaximingXor(object):
|
|||
assert_equal(max_xor(10, 15), 7)
|
||||
print('Success: test_maximizing_xor')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestMaximingXor()
|
||||
test.test_maximizing_xor()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -9,9 +9,11 @@ class TestUtopianTree(object):
|
|||
assert_equal(calc_utopian_tree_height(4), 7)
|
||||
print('Success: test_utopian_tree')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestUtopianTree()
|
||||
test.test_utopian_tree()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -36,7 +36,6 @@
|
|||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"See the [HackerRank problem page](https://www.hackerrank.com/challenges/utopian-tree)."
|
||||
]
|
||||
},
|
||||
|
@ -73,9 +72,6 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# cycles = 0, print 1: base case\n",
|
||||
"# cycles = 1, print 2: i = 1: 1 * 2\n",
|
||||
"# cycles = 4, print 7: i = 1: 1 * 2, i = 2: 2 + 1, i = 3: 3 * 2, i = 4: 6 + 1\n",
|
||||
"def calc_utopian_tree_height(cycles):\n",
|
||||
" # TODO: Implement me\n",
|
||||
" pass"
|
||||
|
@ -110,10 +106,12 @@
|
|||
" assert_equal(calc_utopian_tree_height(4), 7)\n",
|
||||
" print('Success: test_utopian_tree')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestUtopianTree()\n",
|
||||
" test.test_utopian_tree()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"See the [HackerRank problem page](https://www.hackerrank.com/challenges/utopian-tree)."
|
||||
]
|
||||
},
|
||||
|
@ -80,9 +79,6 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# cycles = 0, print 1: base case\n",
|
||||
"# cycles = 1, print 2: i = 1: 1 * 2\n",
|
||||
"# cycles = 4, print 7: i = 1: 1 * 2, i = 2: 2 + 1, i = 3: 3 * 2, i = 4: 6 + 1\n",
|
||||
"def calc_utopian_tree_height(cycles):\n",
|
||||
" height = 1\n",
|
||||
" if cycles == 0:\n",
|
||||
|
@ -131,10 +127,12 @@
|
|||
" assert_equal(calc_utopian_tree_height(4), 7)\n",
|
||||
" print('Success: test_utopian_tree')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestUtopianTree()\n",
|
||||
" test.test_utopian_tree()\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user