java
真的要菜哭啦
这个作者很懒,什么都没留下…
展开
-
三数之和
问题描述给定一个有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 · 118 阅读 · 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 · 220 阅读 · 0 评论