当前位置:网站首页>405. Convert a Number to Hexadecimal
405. Convert a Number to Hexadecimal
2022-08-03 17:02:00 【51CTO】
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.
Note:
All letters in hexadecimal (a-f) must be in lowercase.
The hexadecimal string must not contain extra leading 0s. If the number is zero, it is represented by a single zero character ‘0’; otherwise, the first character in the hexadecimal string will not be the zero character.
The given number is guaranteed to fit within the range of a 32-bit signed integer.
You must not use any method provided by the library which converts/formats the number to hex directly.
Example 1:
Example 2:
边栏推荐
- 使用uniapp 封装一个request 请求
- How to write SQL statements in DataWorks monitoring data reaches a certain value to indicate the change of
- C专家编程 第3章 分析C语言的声明 3.5 typedef可以成为你的朋友
- 九种方法!教你如何读取resources目录下的文件路径
- Halcon 小笔记 C# 图片是否有效
- C专家编程 第3章 分析C语言的声明 3.8 理解所有分析过程的代码段
- FinClip | July 2022 Product Highlights
- Huawei, Lenovo, BAIC, etc. were selected as the first batch of training bases for "Enterprise Digital Transformation and Security Capability Improvement" by the Ministry of Industry and Information Te
- TypeScript的配置文件tsconfig.json
- C专家编程 第3章 分析C语言的声明 3.2 声明是如何形成的
猜你喜欢
【Metaverse系列一】元宇宙的奥秘
组件通信--下拉菜单案例
TiKV & TiFlash 加速复杂业务查询丨TiFlash 应用实践
After using Stream for many years, does collect still have these "saucy operations"?
双指针/滑动窗口问题
产品-Axure9英文版,轮播图效果
最强分布式锁工具:Redisson
The strongest distributed lock tool: Redisson
ORACLE CLOUD 在国内有数据中心吗?
Detailed explanation of setting HiSilicon MMZ memory and OS memory
随机推荐
【数仓】数据质量监控
SQL中对 datetime 类型操作
TiKV & TiFlash accelerate complex business queries丨TiFlash application practice
Understand the recommendation system in one article: Outline 02: The link of the recommendation system, from recalling rough sorting, to fine sorting, to rearranging, and finally showing the recommend
沃尔沃:这是会“种草”的“安全感”!
使用Stream多年,collect还有这些“骚操作”?
J9数字虚拟论:元宇宙的潜力:一股推动社会进步的力量
设置海思芯片MMZ内存、OS内存详解
yolov5s用自己的数据集进行训练模型
被误解的 MVC 和被神化的 MVVM(一)
并发高的情况下,试试用ThreadLocalRandom来生成随机数
【LeetCode】899. 有序队列
uniapp 去掉默认导航栏
双指针/滑动窗口问题
如何直击固定资产管理的难题?
使用.NET简单实现一个Redis的高性能克隆版(一)
leetcode:189. 轮转数组
Async的线程池使用的哪个?
C专家编程 第1章 C:穿越时空的迷雾 1.7 编译限制
C语言04、操作符