Tap here to switch tabs
Problem
Submissions

Problem: Convert a Number to Hexadecimal

med
30 min
Try to solve the Convert a Number to Hexadecimal problem.

Statement

Given an integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement formatting is used.

All letters in the returned hexadecimal string must be lowercase, and the string must not contain any leading zeros unless the number itself is 00.

Constraints:

  • −231≤-2^{31} \leq num ≤231−1\leq 2^{31} - 1

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Convert a Number to Hexadecimal

med
30 min
Try to solve the Convert a Number to Hexadecimal problem.

Statement

Given an integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement formatting is used.

All letters in the returned hexadecimal string must be lowercase, and the string must not contain any leading zeros unless the number itself is 00.

Constraints:

  • −231≤-2^{31} \leq num ≤231−1\leq 2^{31} - 1