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. POJ 2829 Buy Tickets

    Buy Tickets Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 26443   Accepted: 12639 Des ...

  2. DRF源码-views.py

    REST框架提供了一个APIView类,它是Django View类的子类. 要了解几个特点: 请求中body中的数据全部都封装到了data中(原POST,PUT,PATCH,DELETE中的数据全部 ...

  3. 循环指令 LOOP

    循环程序: 如果需要重复执行若干次同样任务.用循环执行 循环指令: LOOP <跳转标号> 用累加器的低字做循环计数器 每次执行LOOP 指令的时候,累加器的低字减去1 若减去后 非零 , ...

  4. Mysql自动备份与还原 转

    Mysql自动备份与还原 一.自动备份:将以下代码保存为*.bat批处理脚本,然后再添加Windows定时作业,如每天凌晨2点执行:set s=%date:~0,4%%date:~5,2%%date: ...

  5. 三十八、SAP设置默认语言

    一.点击系统->用户参数文件->用户数据 二.设置成需要的语言 三.重新登录,并在登录时选择EN 四.进入界面

  6. 201771010142-张燕 实验一 软件工程准备—<软件工程的初步了解和学习目标>

    实验一 软件工程准备 项目 内容 软件工程 https://www.cnblogs.com/nwnu-daizh/ 软件工程准备要求 https://www.cnblogs.com/nwnu-daiz ...

  7. kafka源码系列之mysql数据增量同步到kafka

    一,架构介绍 生产中由于历史原因web后端,mysql集群,kafka集群(或者其它消息队列)会存在一下三种结构. 1,数据先入mysql集群,再入kafka 数据入mysql集群是不可更改的,如何再 ...

  8. springboot - 映射 HTTP Response Status Codes 到自定义 JSP Error 页面

    1.总览 2.代码 1).pom.xml <dependencies> <dependency> <groupId>org.springframework.boot ...

  9. Mysql: if 结构

    if结构 语法 if  条件1  then  语句1; elseif   条件2   then  语句2; ... else 语句n;   # 可以不写 应用场合:应用在begin end 中 SEL ...

  10. 四个因素决定Essay写作段落长度

    段落是一篇Essay的基石,写好Essay应从写好段落开始.那么Essay写作中一个段落多长为好?英语和修辞学教授理查德·诺德奎斯特著文介绍了一些专家的观点.从以下的译文可以看到,段落长度虽然没有固定 ...