
leetcode
真的要菜哭啦
这个作者很懒,什么都没留下…
展开
-
dp中状态转移方程时i,j递增或递减的选择问题
关于dp中i的递增和递减的选择原创 2023-03-06 15:49:37 · 94 阅读 · 0 评论 -
三数之和
问题描述 给定一个有n个元素的数组nums,找出nums中的三个元素a、b、c,使得 a + b + c = 0,找出所有满足条件的三个元素。注意结果中不能包含重复的情况。 Example:nums = [-1, 0, 1, 2, -1, -4] Result:[[-1, 0, 1], [-1, -1, 2]] 先排序,然后取a从零开始,b=a+1,c=nums.length-1;注意边界条件判断 import java.util.ArrayList; import java.util..原创 2020-08-15 08:30:39 · 155 阅读 · 0 评论 -
Leet Code OJ 8. String to Integer (atoi) 字符串转数字
Leet Code OJ 8. String to Integer (atoi) [Difficulty: Easy] 题目: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible i原创 2020-08-06 19:01:56 · 303 阅读 · 0 评论 -
leetcode 1.两数之和
leetcode 1.两数之和 谨以此文纪念我ac过了的第一个rust程序 题目 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nu...原创 2019-05-22 18:11:50 · 204 阅读 · 0 评论