diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/num_to_hex_binary.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/num_to_hex_binary.cpp')
-rw-r--r-- | other/num_to_hex_binary.cpp | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/other/num_to_hex_binary.cpp b/other/num_to_hex_binary.cpp deleted file mode 100644 index 81470fd..0000000 --- a/other/num_to_hex_binary.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "leetcode.h" -#include <string> - -/* - * given integer 'num', return string representing hexidecimal value. - * for negative numbers, use two's complement method - */ - -class Solution { -public: - string toHex(int num) { - string ans; - while (num) { - int rem = num % 16; - if (rem > 9) - switch (rem) { - case 10: - ans = 'a' + ans; - break; - case 11: - ans = 'b' + ans; - break; - case 12: - ans = 'c' + ans; - break; - case 13: - ans = 'd' + ans; - break; - case 14: - ans = 'e' + ans; - break; - case 15: - ans = 'f' + ans; - break; - } - else - ans = char(rem + 48) + ans; - num /= 16; - } - return ans; - } - int toBinary(int num) { - int ans = 0; - return ans; - } -}; - -int main() { - Solution obj; - // obj.toHex(26); - cout << obj.toHex(26) << endl; // expect: "1a" - cout << obj.toHex(-1) << endl; // expect: "fffffff" - cout << obj.toBinary(26) << endl; // expect: 11010 - cout << obj.toBinary(-1) << endl; // expect: -} |