Weikoi

导航

2020年2月20日 #

Leetcode-004-寻找两个有序数组的中位数

摘要: LC第一道Hard题目,插眼待完成。 阅读全文

posted @ 2020-02-20 23:22 Weikoi 阅读(113) 评论(0) 推荐(0)

Leetcode-003-无重复字符最长子串长度

摘要: 动态规划初级题,或者理解为滑动窗口。 class Solution { public int lengthOfLongestSubstring(String s) { Set<Character> demo = new HashSet<>(); int l=0,r=0,result=0; while 阅读全文

posted @ 2020-02-20 18:43 Weikoi 阅读(154) 评论(0) 推荐(0)

Leetcode-002-两数相加

摘要: 本题主要是考查对链表的操作。 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ cl 阅读全文

posted @ 2020-02-20 16:07 Weikoi 阅读(100) 评论(0) 推荐(0)

Leetcode-001-两数之和

摘要: 本题思路是用一个key-value数据结构去保存已经遍历到的数字。 public int[] twoSum(int[] nums, int target) { HashMap<Integer, Integer> hm = new HashMap<>(); for(int i =0; i<nums.l 阅读全文

posted @ 2020-02-20 14:31 Weikoi 阅读(110) 评论(0) 推荐(0)