随笔分类 -  刷题笔记

摘要:https://leetcode-cn.com/problems/4sum-ii/ 因为要求的是元组的数量 思路: 拿两个数组各个元素进行求和,加到map中,剩下的两个数组加和,看有没有符合条件的,有的话,统计次数 class Solution { public int fourSumCount(i 阅读全文
posted @ 2022-01-16 17:38 Zhbeii 阅读(18) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/happy-number/ 当始终不是1的时候,会出现无限循环,那么我们需要拿着个无限循环出现的元素作为判断条件,当这一轮结束到下一个循环的开始会出现重复的元素,我们使用set存储元素,如果n=1或者set中包含n,那么就跳出循环 c 阅读全文
posted @ 2022-01-16 16:23 Zhbeii 阅读(38) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/intersection-of-two-arrays/ 初始化两个set因为输出的元素是不重复的,使用set把第一个数组中的元素弄进来,然后看第二个数组中有没有包含的元素,有的话,加到第二个set中,然后新初始化的一个数组,将第二个s 阅读全文
posted @ 2022-01-16 15:57 Zhbeii 阅读(26) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/ 使用哑结点可以避免许多特殊情况 这道倒数链表是要删除,如果是平时使用正常的快慢指针的话,需要注意快慢指针应该比平时使用差一步,因为要删除慢指针所在的地方,可以让快指针 阅读全文
posted @ 2022-01-15 10:57 Zhbeii 阅读(33) 评论(0) 推荐(0) 编辑
摘要:SQL21 查找在职员工自入职以来的薪水涨幅情况 select b.emp_no,(b.salary-a.salary) as growth from (select e.emp_no,s.salary from employees e left join salaries s on e.emp_n 阅读全文
posted @ 2022-01-10 10:01 Zhbeii 阅读(47) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/5a7975fabe1146329cee4f670c27ad55?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 SELECT last_name, first_name, 阅读全文
posted @ 2022-01-09 11:54 Zhbeii 阅读(70) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/c1472daba75d4635b7f8540b837cc719?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 题解来自:https://blog.nowcoder.net 阅读全文
posted @ 2022-01-09 11:29 Zhbeii 阅读(68) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 SELECT s.emp_no,s.salary FROM 阅读全文
posted @ 2022-01-09 10:57 Zhbeii 阅读(37) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/a32669eb1d1740e785f105fa22741d5c?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 SELECT * FROM employees WHERE 阅读全文
posted @ 2022-01-09 10:22 Zhbeii 阅读(38) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 讲解: https://blog.nowcoder.net/ 阅读全文
posted @ 2022-01-09 10:12 Zhbeii 阅读(50) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/e50d92b8673a440ebdf3a517b5b37d62?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 SELECT de.emp_no, dm.emp_no AS 阅读全文
posted @ 2022-01-09 09:56 Zhbeii 阅读(31) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/ae51e6d057c94f6d891735a48d1c2397?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 select salary from salaries wh 阅读全文
posted @ 2022-01-08 20:41 Zhbeii 阅读(59) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/6d4a4cff1d58495182f536c548fee1ae?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 select a.emp_no,count(*) t fro 阅读全文
posted @ 2022-01-08 18:05 Zhbeii 阅读(47) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/6d35b1cd593545ab985a68cd86f28671?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 select e.last_name,e.first_nam 阅读全文
posted @ 2022-01-08 17:18 Zhbeii 阅读(43) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/c63c5b54d86e4c6d880e4834bfd70c3b?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 select s.*, d.dept_no from sal 阅读全文
posted @ 2022-01-08 17:04 Zhbeii 阅读(38) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/ec1ca44c62c14ceb990c3c40def1ec6c?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1 解析:这道题目注意同一时间的去重操作 select * fr 阅读全文
posted @ 2022-01-08 16:40 Zhbeii 阅读(37) 评论(0) 推荐(0) 编辑
摘要:https://www.nowcoder.com/practice/218ae58dfdcd4af195fff264e062138f?tpId=82&&tqId=29753&rp=1&ru=/ta/sql&qru=/ta/sql/question-ranking select * from empl 阅读全文
posted @ 2022-01-08 15:45 Zhbeii 阅读(59) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/ 因为是链表,所以没法直接从倒数开始,可以从头遍历,得到链表节点的数量,然后再走到那个节点 双指针:(可以不用统计链表长度) 快指针先走k步,然 阅读全文
posted @ 2022-01-01 21:22 Zhbeii 阅读(24) 评论(0) 推荐(0) 编辑
摘要:让该节点下一个节点的值覆盖当前节点,当前节点的指针指向下一个节点的下一个节点 class Solution { public void deleteNode(ListNode node) { ListNode pre = node; ListNode cur = pre.next; pre.val 阅读全文
posted @ 2022-01-01 20:27 Zhbeii 阅读(35) 评论(0) 推荐(0) 编辑
摘要:位运算,判断最后一位是否为一 n - 1 // 二进制最后一位1变成0,右边的0都变成1 n & n -1 //最后一位1 变成0 n & n - 1 这个方法就是在n不等于0之前,每循环一次res就加一,同时二进制的数字里面也消去一个一 int res = 0; while(n != 0) { r 阅读全文
posted @ 2022-01-01 11:36 Zhbeii 阅读(28) 评论(0) 推荐(0) 编辑

more_horiz
keyboard_arrow_up light_mode palette
选择主题
点击右上角即可分享
微信分享提示