0
点赞
收藏
分享

微信扫一扫

DAY19-T1414&T1412 -2022-02-03-非自己作答

小桥流水2016 2022-02-03 阅读 18
class Solution:
    def findMinFibonacciNumbers(self, k: int) -> int:
        f = [1, 1]
        while f[-1] < k:
            f.append(f[-1] + f[-2])
        ans, i = 0, len(f) - 1
        while k:
            if k >= f[i]:
                k -= f[i]
                ans += 1
            i -= 1
        return ans

# 作者:LeetCode-Solution
# 链接:https://leetcode-cn.com/problems/find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k/solution/he-wei-k-de-zui-shao-fei-bo-na-qi-shu-zi-shu-mu-by/

1412 查找成绩处于中游的学生
请添加图片描述
请添加图片描述

select student_id,student_name from student where student_id not in
(
select student_id from(select student_id, rank() over(partition by exam_id order by score desc) as rk1 from exam ) a where rk1=1
union all
select student_id from(select student_id, rank() over(partition by exam_id order by score asc) as rk2 from exam ) b where rk2=1
union all
select student_id from student where student_id not in (select distinct student_id from exam)
)
order by student_id ;

# 作者:the-boondock-saints
# 链接:https://leetcode-cn.com/problems/find-the-quiet-students-in-all-exams/solution/wu-nao-fen-qing-kuang-tao-lun-you-dian-f-9d0w/
举报

相关推荐

0 条评论