随笔分类 -  解题通用技巧

摘要:2021-07-25 18:38:58 dict删除key: dict.pop(key, Default=None) Counter([*]): 对list进行计数操作 ord() / chr(): ord('a') 返回ascii, chr(0) 返回ascii中对应的字符 list删除指定idx 阅读全文
posted @ 2021-07-25 18:39 hyserendipity 阅读(125) 评论(0) 推荐(1)
摘要:REF: https://grantjenks.com/docs/sortedcontainers/ python 优先队列 (默认从小到大排列) SortedList: from sortedcontainers import SortedList 增加元素: sl.add(item) 查询元素: 阅读全文
posted @ 2021-07-04 19:37 hyserendipity 阅读(483) 评论(0) 推荐(0)
摘要:2020-04-06 17:54:20 问题描述: 计算an % b,其中a,b和n都是32位的非负整数。 样例 例如 231 % 3 = 2 例如 1001000 % 1000 = 0 挑战 O(logn) 问题求解: public int fastPower(int a, int b, int 阅读全文
posted @ 2020-04-06 17:57 hyserendipity 阅读(179) 评论(0) 推荐(0)