全部评论
第一题花了太多时间了,最后只会很笨的方法: drop table if exists t0; drop table if exists t1; drop table if exists t2; create table t0 as (select id from fw_advertiser where industry='Car&(14116)#39;); create table t1 as select fwa.name, count(fwc.duration) as total from fw_creative as fwc join fw_advertiser as fwa on fwc.advertiser_id=fwa.id where fwc.duration <= 20 group by fwa.id having fwa.id in (select * from t0); create table t2 as select fwa.name, count(*) as yes from fw_creative as fwc join fw_advertiser as fwa on fwc.advertiser_id=fwa.id group by fwa.id having fwa.id in (select id from fw_advertiser where industry='Car&(14116)#39;); select t1.name as advertiser_name, t2.yes / t1.total as percentage from t1 join t2 on t1.name = t2.name; 第二题就是层次遍历就行了。 第三题没时间看
第二题层序遍历100% 通过了,计算每层的最小耗时
第三题我用自定义排序加DP只过了四分之一,哪位老哥探讨下到底咋做...
第三题我的想法是转换成图,当i可以排在j的前面的时候存在一条有向边<i, j>,然后选择一些节点开始深搜,最后找到一条最大的路径
第三题一开始两层for循环只能33.33%,后来直接递归写了,过了60%
第一题具体忘了,大概是 select fw_ad.name, round(sum(case when xxx<=20 1 else 0 end) / sum(1), 2) as result from fw_creative left join fw_ad on fw_creative.ad_id=fw_ad.id where fw_ad.industry="Car" group by fw_ad.name order by fw_ad.name 第二题层次遍历,但是不知道是数据有很多边界情况还是我写的代码不对,改了好多才ac 第三题没时间想了,随便写了点,过了13%……
第二题难道我理解错题目了?只过了20% 大佬咋写的
哎,sql不太熟,想了太久,后面第三题直接没写
第三题和lc1691 堆叠长方体最大高度 有啥区别呀? dp只能过33%😭
第三题感觉和偏序关系啥的有关,没做出来...
如果是2坏了,只需要算1,2层的cost就行了,你们考虑了吗
第一题sql没写,第二题层序遍历a了,第三题记忆化搜索a了
平时这种hive sql/odps写的都要吐了,然后还是0%,搞不懂,我这么多年的sql都是错的?
第三题感觉类似俄罗斯信封套娃,按照那个思路写就能过
AC代码:https://www.nowcoder.com/discuss/732388?source_id=profile_create_nctrack&channel=-1
这题都有什么corner case啊怎么就过不了呢
相关推荐
点赞 评论 收藏
分享


点赞 评论 收藏
分享
01-24 14:16
西南财经大学 数据运营 点赞 评论 收藏
分享
点赞 评论 收藏
分享