摘要: MySql_176. 第二高的薪水 LeetCode_MySql_176 题目描述 题解分析 代码实现 # Write your MySQL query statement below select( select distinct Salary from Employee order by Sal 阅读全文
posted @ 2021-03-01 22:23 Garrett_Wale 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 653. 两数之和 IV - 输入 BST 题目描述 题解分析 最简单的方法就是遍历整棵树,找出所有可能的组合,判断是否存在和为 kk 的一对节点。现在在此基础上做一些改进。 如果存在两个元素之和为 k,即 x+y=k,并且已知 x 是树上一个节点的值,则只需判断树上是否存在一个值为 y 的节点,使 阅读全文
posted @ 2021-03-01 20:25 Garrett_Wale 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 1. JMM的介绍 在上一篇文章中总结了线程的状态转换和一些基本操作,对多线程已经有一点基本的认识了,如果多线程编程只有这么简单,那我们就不必费劲周折的去学习它了。在多线程中稍微不注意就会出现线程安全问题,那么什么是线程安全问题?我的认识是,在多线程下代码执行的结果与预期正确的结果不一致,该代码就是 阅读全文
posted @ 2021-03-01 19:07 Garrett_Wale 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 167. 两数之和 II - 输入有序数组 LeetCode_167 题目描述 方法一:暴力法(使用哈希表) class Solution { public int[] twoSum(int[] numbers, int target) { int len = numbers.length; Has 阅读全文
posted @ 2021-03-01 18:00 Garrett_Wale 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 1. 两数之和 LeetCode_1 题目描述 方法一:暴力法 package com.walegarrett.interview; /** * @Author WaleGarrett * @Date 2021/3/1 12:21 */ /** * 题目描述:给定一个整数数组 nums 和一个整数目 阅读全文
posted @ 2021-03-01 17:42 Garrett_Wale 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 381. O(1) 时间插入、删除和获取随机元素 - 允许重复 LeetCode_381 题目详情 题解分析 代码实现 package com.walegarrett.interview; import java.util.*; /** * @Author WaleGarrett * @Date 2 阅读全文
posted @ 2021-03-01 10:15 Garrett_Wale 阅读(60) 评论(0) 推荐(0) 编辑