Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Convert a Number to Hexadecimal (Easy 405)

Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.

Solution:

Click here If number is negative add 2^32 to it to get two's complement. Iterate over number, add mod 16 to result, and divide number by 16 each time. O(n) time, O(n) space.



Installation

Run make to run python and Swift files.