随笔分类 -  力扣

摘要:// 二分查找 [left, right] // 数组已经是有序的了! public static int binarySerach1(int[] nums, int target) { if (nums == null || nums.length == 0) { return -1; } int 阅读全文
posted @ 2022-09-05 22:48 wjxuriel 阅读(47) 评论(0) 推荐(0)
摘要:class Solution { public ListNode mergeTwoLists(ListNode list1, ListNode list2) { if(list1 == null){ return list2; } if(list2 == null){ return list1; } 阅读全文
posted @ 2022-05-15 14:08 wjxuriel 阅读(30) 评论(0) 推荐(0)
摘要:/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(int val) { 阅读全文
posted @ 2022-05-13 18:30 wjxuriel 阅读(33) 评论(0) 推荐(0)
摘要:给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。 示例 1: 输入:nums = [2,7, 阅读全文
posted @ 2022-05-01 22:09 wjxuriel 阅读(27) 评论(0) 推荐(0)