maths.perfect_cube ================== .. py:module:: maths.perfect_cube Functions --------- .. autoapisummary:: maths.perfect_cube.perfect_cube maths.perfect_cube.perfect_cube_binary_search Module Contents --------------- .. py:function:: perfect_cube(n: int) -> bool Check if a number is a perfect cube or not. >>> perfect_cube(27) True >>> perfect_cube(4) False .. py:function:: perfect_cube_binary_search(n: int) -> bool Check if a number is a perfect cube or not using binary search. Time complexity : O(Log(n)) Space complexity: O(1) >>> perfect_cube_binary_search(27) True >>> perfect_cube_binary_search(64) True >>> perfect_cube_binary_search(4) False >>> perfect_cube_binary_search("a") Traceback (most recent call last): ... TypeError: perfect_cube_binary_search() only accepts integers >>> perfect_cube_binary_search(0.1) Traceback (most recent call last): ... TypeError: perfect_cube_binary_search() only accepts integers