LeetCode No.166,167,168
No.166 FractionToDecimal 分数到小数
题目
- 给定两个整数,分别表示分数的分子 numerator 和分母 denominator,以字符串形式返回小数。
- 如果小数部分为循环小数,则将循环的部分括在括号内。
示例
输入: numerator = 1, denominator = 2
输出: "0.5"
输入: numerator = 2, denominator = 1
输出: "2"
输入: numerator = 2, denominator = 3
输出: "0.(6)"
思路
代码
No.167 TwoSum 两数之和 II - 输入有序数组
题目
- 给定一个已按照升序排列 的有序数组,找到两个数使得它们相加之和等于目标数。
- 函数应该返回这两个下标值 index1 和 index2,其中 index1 必须小于 index2。
- 说明:
- 返回的下标值(index1 和 index2)不是从零开始的。
- 你可以假设每个输入只对应唯一的答案,而且你不可以重复使用相同的元素。
示例
输入: numbers = [2, 7, 11, 15], target = 9
输出: [1,2]
解释: 2 与 7 之和等于目标数 9 。因此 index1 = 1, index2 = 2 。
思路
代码
No.168 ConvertToTitle Excel表列名称
题目
- 给定一个正整数,返回它在 Excel 表中相对应的列名称。
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
...
示例
输入: 1
输出: "A"
输入: 28
输出: "AB"
输入: 701
输出: "ZY"
思路
代码
LeetCode No.166,167,168的更多相关文章
- LeetCode Contest 166
LeetCode Contest 166 第一次知道LeetCode 也有比赛. 很久没有打过这种线上的比赛,很激动. 直接写题解吧 第一题 很弱智 class Solution { public: ...
- 【LeetCode】166. Fraction to Recurring Decimal 解题报告(Python)
[LeetCode]166. Fraction to Recurring Decimal 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingz ...
- [LeetCode&Python] Problem 167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that the ...
- 【LeetCode】166. Fraction to Recurring Decimal
Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fra ...
- LeetCode(166) Fraction to Recurring Decimal
题目 Given two integers representing the numerator and denominator of a fraction, return the fraction ...
- LeetCode Array Easy 167. Two Sum II - Input array is sorted
Description Given an array of integers that is already sorted in ascending order, find two numbers s ...
- 【刷题-LeetCode】166 Fraction to Recurring Decimal
Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fra ...
- LeetCode题目解答
LeetCode题目解答——Easy部分 Posted on 2014 年 11 月 3 日 by 四火 [Updated on 9/22/2017] 如今回头看来,里面很多做法都不是最佳的,有的从复 ...
- C++版-剑指offer 面试题6:重建二叉树(Leetcode105. Construct Binary Tree from Preorder and Inorder Traversal) 解题报告
剑指offer 重建二叉树 提交网址: http://www.nowcoder.com/practice/8a19cbe657394eeaac2f6ea9b0f6fcf6?tpId=13&tq ...
随机推荐
- 安卓Recycleview简单的网格布局-初学者的关键点
导包 def supportVersion = '28.0.0' 定义常量我的sdk版本为28 implementation "com.android.support:recyclervie ...
- P1044 火星数字
P1044 火星数字 转跳点:
- htmp to pdf
C++ Library to Convert HTML to PDF html2pdf PrinceXML 收费 CutePDF Ghostscript PDFDoc VisPDF PDFDoc Sc ...
- MongoDB 副本集搭建
搭建mongodb副本集 [root@ mongodb]# cd /u02 [root@ u02]# mkdir -p mongodb/data_2777 [root@ u02]# mkdir -p ...
- 端口通不通 telnet wget ssh
如何测试端口通不通(四种方法) 投稿:mrr 一般情况下使用"telnet ip port"判断端口通不通.接下来通过本文给大家分享四种方法测试端口通不通,感兴趣的朋友一起学习吧 ...
- Spring Cloud 支付宝支付的流程
沙箱环境又称沙盘,为了开发与调试所提供的环境,它与生产环境互相隔离,但具有生产环境几乎完全相同的功能蚂蚁金服开放平台——开发者中心1.https://openhome.alipay.com2.提供的调 ...
- 第二阶段scrum-10
1.整个团队的任务量: 2.任务看板: 会议照片: 产品状态: 等待发布
- Eclipse中jsp、js文件编辑时,卡死现象解决汇总(转)
使用Eclipse编辑jsp.js文件时,经常出现卡死现象,在网上百度了N次,经过N次优化调整后,卡死现象逐步好转,具体那个方法起到作用,不太好讲.将所有用过的方法罗列如下: 1.取消验证 win ...
- oracle问题:char类型数据查询不到
select distinct id,name from test_table b where b.ID='001' ; id为char字段类型,使用该语句查询不出数据. 解决方法:加trim().改 ...
- 启用sql日志
SHOW VARIABLES LIKE "general_log%"; -- 查询是否启用日志 SET GLOBAL general_log = 'ON'; -- 设置启用 SE ...