老北京2018
老北京2018
全部文章
分类
题解(11)
归档
标签
去牛客网
登录
/
注册
老北京2018的博客
全部文章
(共11篇)
题解 | #近三个月未完成试卷数为0的用户完成情况#
写点不一样的解法 uid, exam_complete_cnt from ( select r.uid, sum(submit_time is not null) exam_complete_cnt from exam_record r where (uid, date_fo...
Mysql
2021-11-25
0
402
题解 | #连续两次作答试卷的最大时间窗#
select a.uid, days_window, round(b.`avg` * a.days_window, 2)avg_exam_cnt from ( select uid, max(days_window)days_window from ( select u...
Mysql
2021-11-24
0
411
题解 | #调整数组顺序使奇数位于偶数前面(二)#
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param array int整型一维数组 *...
Java
2021-10-19
0
430
题解 | #获得积分最多的人(二)#
select g.user_id, u.name, g.grade_num from ( select user_id, sum(grade_num) grade_num from `grade_info` group by user_id)g left join `use...
Mysql
2021-10-15
0
413
题解 | #商品交易(网易校招笔试真题)#
select g.id,g.name,g.weight,t.total from goods g left join (select goods_id,sum(count) total from trans group by goods_id) t on g.id = t.goods_id wh...
Mysql
2021-10-15
0
326
题解 | #构建乘积数组#
最容易想到的就是暴力法,依次求出每个B[i],但是这样的时间复杂度为O(n^2),效率太低了。 既然暴力法效率太低,那就看看能不能找出B[i]之间的关系来提高效率。 由上图可以发现 B[i]的左半部分(红色部分)和B[i-1]有...
Java
2021-10-14
2
616
题解 | #浙大不同难度题目的正确率#
select d.difficult_level,sum(if(pd.`result`='right',1,0))/count(1) correct_rate from (select device_id from user_profile where university = '浙江大学') u ...
Mysql
2021-10-11
0
317
题解 | #按之字形顺序打印二叉树#
select e.emp_no,s.salary,e.last_name,e.first_name from employees e join (select emp_no,salary from salaries where salary = (select MAX(salary) salary ...
2021-08-26
0
312
题解 | #数组中只出现一次的两个数字#
使用哈希表将数字集中起来,判断哈希表中统计数字为1得两个数就是要找的目标数
2021-08-12
1
405
题解 | #装最多水的容器#
方法1:暴力解法: class Solution { public: int maxArea(vector<int>& height) { int max = 0; for(int i =0; i<height.size();...
2021-05-26
0
662
首页
上一页
1
2
下一页
末页