刷题
文章平均质量分 54
面向基础算法与数据结构
milk_and_bread
这个作者很懒,什么都没留下…
展开
-
122. Best Time to Buy and Sell Stock II
122. Best Time to Buy and Sell Stock II You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any t原创 2021-11-10 15:41:22 · 121 阅读 · 0 评论 -
剑指 Offer II 001. 整数除法
题目描述 给定两个整数 a 和 b ,求它们的除法的商 a/b ,要求不得使用乘号 ‘*’、除号 ‘/’ 以及求余符号 ‘%’ 。 注意: 整数除法的结果应当截去(truncate)其小数部分,例如:truncate(8.345) = 8 以及 truncate(-2.7335) = -2 假设我们的环境只能存储 32 位有符号整数,其数值范围是 [−231, 231−1]。本题中,如果除法结果溢出,则返回 231 − 1 示例 1: 输入:a = 15, b = 2 输出:7 解释:15/2 = t原创 2021-12-23 21:56:57 · 311 阅读 · 0 评论 -
【1】两数之和
1. 两数之和 题目 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。 示例 1: 输入:nums = [2,7,11,15], target = 9 输出:[0,1] 解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。 示例 2: 输入:nums = [3,原创 2022-01-17 21:04:39 · 126 阅读 · 0 评论