当前位置:网站首页>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:
边栏推荐
猜你喜欢
The strongest distributed lock tool: Redisson
leetcode:187. 重复的DNA序列
自动化部署+整合SSM项目
《社会企业开展应聘文职人员培训规范》团体标准在新华书店上架
2年开发经验去面试,吊打面试官,即将面试的程序员这些笔记建议复习
【目标检测】Focal Loss for Dense Object Detection
[Unity Starter Plan] Making RubyAdventure01 - Player Creation & Movement
“LaMDA 存在种族歧视,谷歌的 AI 伦理不过是‘遮羞布’!”
phoenix创建映射表和创建索引、删除索引
protobuf 反射使用总结
随机推荐
LeetCode·72.编辑距离·动态规划
C专家编程 第1章 C:穿越时空的迷雾 1.9 阅读ANSI C标准,寻找乐趣和裨益
Excuse me this hologres dimension table is cached?How to Finished
产品-Axure9英文版,轮播图效果
uniapp 切换 history 路由模
sphinx coreseek的安装和php下使用
phoenix创建映射表和创建索引、删除索引
C专家编程 第3章 分析C语言的声明 3.8 理解所有分析过程的代码段
广告电商系统开发之会员系统板块
数据中台“集存通用治”功能场景说明
大型企业数据治理的现状和解决方案有哪些参考?_光点科技
高薪程序员&面试题精讲系列132之微服务之间如何进行通信?服务熔断是怎么回事?你熟悉Hystrix吗?
【GAMES101】作业6 加速结构
【数仓】数据质量监控
C语言02、语句、函数
TiKV & TiFlash accelerate complex business queries丨TiFlash application practice
SQL中对 datetime 类型操作
C专家编程 第2章 这不是Bug,而是语言特性 2.3 误做之过
设置海思芯片MMZ内存、OS内存详解
JS 字符串转 GBK 编码超精简实现