![](https://img-blog.csdnimg.cn/20200703133421788.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
LeetCode
记录在力扣(LeetCode)做过的题
技术的搬运工
不念过去,不畏将来,只争朝夕
展开
-
0007.整数反转(简单)
代码:(java版) public class Solution { // 反转 public static int reverse(int x) { // int aa = (int)Math.pow(2, 31) - 1; // 2147483646 // int bb = -(int)Math.pow(2, 31); // -2147483647 int res = 0; while (x != 0) { ..原创 2021-05-08 10:43:11 · 81 阅读 · 0 评论 -
0001.两数之和(简单)
题目描述: 给定一个整数数组 nums和一个目标值 target,请你在该数组中找出和为目标值的那两个整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1] 代码:(Java版) public int[] twoSum(int[] nums, int target) {...原创 2020-07-03 23:50:07 · 188 阅读 · 0 评论