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. 如何让你的学术Essay写作看起来更高级?

    学术风格不仅是使用某些特定的词汇或者特定的表达方式.学术风格还会涉及到你的思考方式.推理方式以及你如何利用某个领域内已知的发现.学术风格是英国大学学习的核心.所以在平时的学习中,英国环球论文小编建议大 ...

  2. js实现连续输入之后发送请求

    输入框是我们经常会用到的功能,想要实现输入就请求的功能 但是在实际开发中,为了减少服务器压力,会在输入之后停留1s没有输入之后再进行搜索 研究之后用原生js及表单写了一个简单的demo,如果有好的de ...

  3. Mac 设置git的template

    1.在home目录下修改.gitconfig(没有新建) 2. 在home下新建 .setCommitMsg 文件 3.然后将一下内容复制到文件中 # <类型>: (类型的值见下面描述) ...

  4. JavaScript原生Ajax请求纯文本数据

    源代码 ajax1.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"&g ...

  5. 2.14 Java web 复习总结

    1.空指针异常原因(NullPointerExceptio)之一: 在Dao层里边 声明 Connection conn = DBUtil.getConn(); //不能少 Statement sta ...

  6. C++寒假作业2

    这个作业属于哪个课程 https://edu.cnblogs.com/campus/fzu/2020OOP 这个作业要求在哪里 https://edu.cnblogs.com/campus/fzu/2 ...

  7. SciKit-Learn 数据集基本信息

    ## 保留版权所有,转帖注明出处 章节 SciKit-Learn 加载数据集 SciKit-Learn 数据集基本信息 SciKit-Learn 使用matplotlib可视化数据 SciKit-Le ...

  8. mysql 深度分页

    mysql  分页查询使我们常见的需求 ,但是随着页数的增加查询性能会逐渐下降,尤其是到深度分页的情况.我们可以把分页分为两个步骤,1.定位偏移量,2.获取分页条数的 数据. 所以当数据较大页数较深时 ...

  9. Python 内置类型 dict, list,线程安全吗

    近段时间发现一个 Python 连接数据库的连接是线程不安全的,结果惹得我哪哪儿都怀疑变量的多线程是否安全的问题,今天终于找到了正确答案,那就是 Python 内置类型 dict,list ,tupl ...

  10. UVA - 818 Cutting Chains(切断圆环链)(dfs + 二进制法枚举子集)

    题意:有n个圆环(n<=15),已知已经扣在一起的圆环,现在需要打开尽量少的圆环,使所有圆环可以组成一条链. 分析:因为不知道要打开哪个环,如果列举所有的可能性,即枚举打开环的所有子集,最多才2 ...