随笔分类 - 菜鸟刷题路
随缘刷题、leetcode hot 100、牛客题霸、剑指offer
发表于 2020-10-11 16:21阅读:175评论:0推荐:0
摘要:16、统计出当前(titles.to_date='9999-01-01')各个title类型对应的员工当前(salaries.to_date='9999-01-01')薪水对应的平均工资。结果给出title以及平均工资avg。 CREATE TABLE `salaries` ( `emp_no` i
阅读全文 »
发表于 2020-10-10 22:12阅读:223评论:0推荐:0
摘要:1、查找最晚入职员工的所有信息,为了减轻入门难度,目前所有的数据里员工入职的日期都不是同一天(sqlite里面的注释为--,mysql为comment) CREATE TABLE `employees` ( `emp_no` int(11) NOT NULL, -- '员工编号' `birth_da
阅读全文 »
发表于 2019-11-21 22:08阅读:56评论:0推荐:0
摘要:剑指 Offer 09. 用两个栈实现队列 用两个栈实现一个队列。队列的声明如下,请实现它的两个函数 appendTail 和 deleteHead ,分别完成在队列尾部插入整数和在队列头部删除整数的功能。(若队列中没有元素,deleteHead 操作返回 -1 ) class CQueue { S
阅读全文 »
发表于 2019-11-20 12:08阅读:53评论:0推荐:0
摘要:剑指 Offer 06. 从尾到头打印链表 class Solution { public int[] reversePrint(ListNode head) { Stack<Integer> stack = new Stack<>(); while(head != null){ stack.pus
阅读全文 »
发表于 2019-11-20 11:18阅读:49评论:0推荐:0
摘要:剑指 Offer 05. 替换空格 class Solution { public String replaceSpace(String s) { StringBuilder str = new StringBuilder(s); int p1 = str.length() - 1; for(int
阅读全文 »
发表于 2019-11-20 10:59阅读:50评论:0推荐:0
摘要:剑指 Offer 03. 数组中重复的数字 哈希表/set class Solution { public int findRepeatNumber(int[] nums) { HashSet<Integer> set = new HashSet<>(); for(int num : nums){
阅读全文 »
发表于 2019-11-20 10:02阅读:61评论:0推荐:0
摘要:lc88 class Solution { public void merge(int[] nums1, int m, int[] nums2, int n) { int i = m - 1, j = n - 1; int p = m + n - 1; while(i >= 0 && j >= 0)
阅读全文 »