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的更多相关文章

  1. LeetCode Contest 166

    LeetCode Contest 166 第一次知道LeetCode 也有比赛. 很久没有打过这种线上的比赛,很激动. 直接写题解吧 第一题 很弱智 class Solution { public: ...

  2. 【LeetCode】166. Fraction to Recurring Decimal 解题报告(Python)

    [LeetCode]166. Fraction to Recurring Decimal 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingz ...

  3. [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 ...

  4. 【LeetCode】166. Fraction to Recurring Decimal

    Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fra ...

  5. LeetCode(166) Fraction to Recurring Decimal

    题目 Given two integers representing the numerator and denominator of a fraction, return the fraction ...

  6. 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 ...

  7. 【刷题-LeetCode】166 Fraction to Recurring Decimal

    Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fra ...

  8. LeetCode题目解答

    LeetCode题目解答——Easy部分 Posted on 2014 年 11 月 3 日 by 四火 [Updated on 9/22/2017] 如今回头看来,里面很多做法都不是最佳的,有的从复 ...

  9. C++版-剑指offer 面试题6:重建二叉树(Leetcode105. Construct Binary Tree from Preorder and Inorder Traversal) 解题报告

    剑指offer 重建二叉树 提交网址: http://www.nowcoder.com/practice/8a19cbe657394eeaac2f6ea9b0f6fcf6?tpId=13&tq ...

随机推荐

  1. [题解] LuoguP4091 [HEOI2016/TJOI2016]求和

    传送门 首先我们来看一下怎么求\(S(m,n)\). 注意到第二类斯特林数的组合意义就是将\(m\)个不同的物品放到\(n\)个没有区别的盒子里,不允许有空盒子的方案数. 那么将\(m\)个不同的物品 ...

  2. HDU - 1698 Just a Hook (线段树---区间修改)

    题意:n个棍子,初始值全为1,给定Q个区间,分别赋值,问n个棍子的总值. 分析:lazy标记主要体现在update上. 当l <= L && R <= r时,该结点的子结点 ...

  3. 51nod:天堂里的游戏

    天堂里的游戏 李陶冶 (命题人) System Message (测试) 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 多年后,每当Noder看到吉普赛人,就会想起那个遥远的下午. ...

  4. html5游戏的横屏问题

    html5 API有这个参数 Screen Orientation API 可以看w3c定义的规范 The Screen Orientation API <!-- UC强制竖屏 --> & ...

  5. Python 中 对logging 模块进行封装,记录bug日志、日志等级

    是程序产生的日志 程序员自定义设置的 收集器和渠道级别那个高就以那个级别输出 日志和报告的作用: 报告的重点在于执行结果(执行成功失败,多少用例覆盖),返回结果 日志的重点在执行过程当中,异常点,哪里 ...

  6. 十二、JavaScript之变量申明

    一.代码如下 二.运行效果如下 <!DOCTYPE html> <html> <meta http-equiv="Content-Type" cont ...

  7. 092-PHP定义索引数组

    <?php $arr=array('name'=>'PHP','age'=>22,7=>25,33,21=>35,56); //定义一个索引数组 echo '数组$arr ...

  8. 吴裕雄--天生自然C++语言学习笔记:C++ 基本的输入输出

    C++ 的 I/O 发生在流中,流是字节序列.如果字节流是从设备(如键盘.磁盘驱动器.网络连接等)流向内存,这叫做输入操作.如果字节流是从内存流向设备(如显示屏.打印机.磁盘驱动器.网络连接等),这叫 ...

  9. oracle问题:char类型数据查询不到

    select distinct id,name from test_table b where b.ID='001' ; id为char字段类型,使用该语句查询不出数据. 解决方法:加trim().改 ...

  10. UVA - 10003 Cutting Sticks(切木棍)(dp)

    题意:有一根长度为L(L<1000)的棍子,还有n(n < 50)个切割点的位置(按照从小到大排列).你的任务是在这些切割点的位置处把棍子切成n+1部分,使得总切割费用最小.每次切割的费用 ...