上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 26 下一页
摘要: 415. 字符串相加 LeetCode_415 题目详情 方法一:使用暴力法 class Solution { public String addStrings(String num1, String num2) { int len1 = num1.length(); int len2 = num2 阅读全文
posted @ 2021-03-06 21:44 Garrett_Wale 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 196. 删除重复的电子邮箱 LeetCode_MySql_196 题目描述 实现代码 # Write your MySQL query statement below # 需要找到两张表中,其他记录中具有相同邮件地址但是id更大的记录,将其删除即可 delete p1 from Person p1 阅读全文
posted @ 2021-03-06 21:22 Garrett_Wale 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 145. 二叉树的后序遍历 LeetCode_145 题目描述 递归解法 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; 阅读全文
posted @ 2021-03-05 18:57 Garrett_Wale 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 94. 二叉树的中序遍历 LeetCode_94 题目描述 解法一:递归解法 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right 阅读全文
posted @ 2021-03-05 18:40 Garrett_Wale 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 160. 相交链表 LeetCode_160 题目描述 题解分析 本题使用的方法是双指针法,题目和环形链表相似,都是利用链表的特性来求解。 当遍历链表a到达尾部时,再指向链表b的头部;当遍历链表b到末尾时,再指向链表a的头部。 再次相遇时便是相交结点。 java代码 /** * Definition 阅读全文
posted @ 2021-03-05 17:59 Garrett_Wale 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 142. 环形链表 II LeetCode_142 题目描述 题解分析 判断链表是否存在环 对于这个问题我们可以采用“快慢指针”的方法。就是有两个指针fast和slow,开始的时候两个指针都指向链表头head,然后在每一步操作中slow向前走一步即:slow = slow->next,而fast每一 阅读全文
posted @ 2021-03-04 21:57 Garrett_Wale 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 1.总述 java命令用来启动一个java应用。有以下两种用法: java [options] mainClass [args...] java [options] -jar jarfile [args...] 第一种从指定的java类开始启动,第二种从可运行的jar开始启动。java应用启动的过程 阅读全文
posted @ 2021-03-04 17:55 Garrett_Wale 阅读(942) 评论(0) 推荐(0) 编辑
摘要: 处理海量数据问题的四板斧 分治 基本上处理海量数据的问题,分治思想都是能够解决的,只不过一般情况下不会是最优方案,但可以作为一个baseline,可以逐渐优化子问题来达到一个较优解。传统的归并排序就是分治思想,涉及到大量无法加载到内存的文件、排序等问题都可以用这个方法解决。 适用场景:数据量大无法加 阅读全文
posted @ 2021-03-04 09:26 Garrett_Wale 阅读(8121) 评论(0) 推荐(4) 编辑
摘要: 11. 设计模式 11.0 设计原则 单一职责原则 不要存在多于一个导致类变更的原因。 总结:一个类只负责一项职责。 里氏替换原则 子类可以实现父类的抽象方法,但不能覆盖父类的非抽象方法。 子类中可以增加自己特有的方法。 当子类的方法重载父类的方法时,方法的前置条件(即方法的形参)要比父类方法的输入 阅读全文
posted @ 2021-03-03 21:37 Garrett_Wale 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 185. 部门工资前三高的所有员工 LeetCode_MySql_185 题目描述 方法一:使用join on # Write your MySQL query statement below select d.Name as 'Department', e1.Name as 'Employee', 阅读全文
posted @ 2021-03-03 20:20 Garrett_Wale 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 5. 最长回文子串 LeetCode_5 题目详情 方法一:暴力法(超时) class Solution { public String longestPalindrome(String s) { int len = s.length(); int maxLen = 0; String result 阅读全文
posted @ 2021-03-03 19:18 Garrett_Wale 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 184. 部门工资最高的员工 LeetCode_MySql_184 题目描述 题解分析 1.首先需要使用group by找出工资最高的值 2. 然后考虑到最高工资的可能有多位,所以使用in语句找到所有符合条件的员工 3. 最外层使用连接连表查询员工所在的部门名字。 代码实现 # Write your 阅读全文
posted @ 2021-03-02 20:05 Garrett_Wale 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 183. 从不订购的客户 LeetCode_MySql_183 题目描述 代码实现 # Write your MySQL query statement below select Name as 'Customers' from Customers where Customers.Id not in 阅读全文
posted @ 2021-03-02 19:14 Garrett_Wale 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 182. 查找重复的电子邮箱 LeetCode_MySql_182 题目描述 方法一:使用笛卡尔积 # Write your MySQL query statement below select distinct t1.Email from Person t1, Person t2 where t1 阅读全文
posted @ 2021-03-02 18:28 Garrett_Wale 阅读(84) 评论(0) 推荐(0) 编辑
摘要: MySQL中的存储引擎 一、存储引擎 1、存储引擎其实就是对于数据库文件的一种存取机制,如何实现存储数据,如何为存储的数据建立索引以及如何更新,查询数据等技术实现的方法。 2、MySQL中的数据用各种不同的技术存储在文件(或内存)中,这些技术中的每一种技术都使用不同的存储机制,索引技巧,锁定水平并且 阅读全文
posted @ 2021-03-02 12:15 Garrett_Wale 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 181. 超过经理收入的员工 LeetCode_MySql_181 题目描述 方法一:笛卡尔积 # Write your MySQL query statement below select e1.Name as 'Employee' from Employee e1, Employee e2 wh 阅读全文
posted @ 2021-03-02 11:12 Garrett_Wale 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 180. 连续出现的数字 LeetCode_MySql_180 题目描述 代码实现 # Write your MySQL query statement below select distinct t1.num as ConsecutiveNums from Logs t1, Logs t2, Lo 阅读全文
posted @ 2021-03-02 10:46 Garrett_Wale 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 178. 分数排名 LeetCode_MySql_178 题目描述 题解分析 排名函数 DENSE_RANK()。如果使用 DENSE_RANK() 进行排名会得到:1,1,2,3,4。 RANK()。如果使用 RANK() 进行排名会得到:1,1,3,4,5。 ROW_NUMBER()。如果使用 阅读全文
posted @ 2021-03-02 10:33 Garrett_Wale 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 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 ··· 8 9 10 11 12 13 14 15 16 ··· 26 下一页