加载中...
分类详情
简单 分类
LCP 02-分式化简(Deep Dark Fraction)
原文链接: https://leetcode-cn.com/problems/deep-dark-fraction 中文题目有一个同学在学习分式。他需要将一个连分数化成最简分数,你能帮助他吗? 连分数是形如上图的分式。在本题中,所有系数都是大于等于0的整数。 输入的cont代表连分数的系数(cont[0]代表上图的a0,以此类推)。返回一个长度为2的数组[n, m],使得连分数的值等于n / m,且n, m最大公约数为1。 示例 1: 输入:cont = [3, 2, 0, 2] 输出:[13,…
2021-12-03
LCP 01-猜数字(Guess Numbers)
原文链接: https://leetcode-cn.com/problems/guess-numbers 中文题目小A 和 小B 在玩猜数字。小B 每次从 1, 2, 3 中随机选择一个,小A 每次也从 1, 2, 3 中选择一个猜。他们一共进行三次这个游戏,请返回 小A 猜对了几次? 输入的guess数组为 小A 每次的猜测,answer数组为 小B 每次的选择。guess和answer的长度都等于3。 示例 1: 输入:guess = [1,2,3], answer = [1,2,3] 输出…
2021-12-03
面试题 01.03-URL化(String to URL LCCI)
原文链接: https://leetcode-cn.com/problems/string-to-url-lcci 英文原文Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the end to hold the additional characters,and that you are given the "tr…
2021-12-03