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 ...
随机推荐
- class(二)--派生类的继承
前言 从我之前的一篇笔记对象的继承中, 我们可以知道JS的继承方式依赖原型链,而比较好的继承方式是寄生组合式继承 先来温习下什么是寄生组合式继承 function Rectangle(length, ...
- UVA - 10891 Game of Sum (区间dp)
题意:AB两人分别拿一列n个数字,只能从左端或右端拿,不能同时从两端拿,可拿一个或多个,问在两人尽可能多拿的情况下,A最多比B多拿多少. 分析: 1.枚举先手拿的分界线,要么从左端拿,要么从右端拿,比 ...
- 从高通出重拳,iPhone遭禁售看巨头们的专利大战
一直以来,高通看起来都是很有"骨气"的.面对与苹果的专利纷争,高通始终是据理力争.顽强对抗.截至今年6月中旬,高通和苹果打了50多场专利官司,且这些官司分布于6个不同国家的16个司 ...
- windows下移植别人配置好的python环境
一般来说,我们在windows下配置python环境的时候可能会比较推荐用anaconda,那么有一个比较方便的anaconda环境移植方法,也就是说,如果我已经在windows上安装好了anacon ...
- BeanUtils使用将一个对象拷贝到另外一个对象
这里的BeanUtils是BeanUtils是org.springframework.beans.BeanUtils,和org.apache.commons.beanutils.BeanUtils是有 ...
- 七十一、SAP中内表的修改,改一行数据,或一行的某个字段
一.SAP中内表的修改,只能通过工作区来修改,代码如下 二.效果如下
- Power BI角色控制
Case:企业的数据分析报表经常需要进行权限控制,根据读者的部门或职位,决定他可以看到的数据.例如,A部门的人只能查看A部门的数据,B部门的人只能查看B部门的数据,而领导层则可以看到所有的数据. 1, ...
- ACM-奇特的立方体
题目描述:奇特的立方体 任意给出8个整数,将这8个整数分别放在一个立方体的八个顶点上,要求检验每个面上的四个数之和相等这个条件能否被满足. 输入 一次输入8个整数 输出 YES或者NO YES表示可能 ...
- 【数据库】Function&Procedure&Package
Function/Procedure都是可独立编译并存储在数据库中的,区别是Function有返回值. Package则是数据和过程.函数的集合体. CREATE PROCEDURE dorepeat ...
- check Linux文件夹个数
(ls -l|grep "^-"| wc -l)查看某个文件夹下文件的个数.(ls -lR|grep "^-"| wc -l)查看某个文件夹下文件的个数,包括子 ...