上一页 1 2 3 4 5 6 ··· 10 下一页
摘要: https://leetcode-cn.com/problems/hanota-lcci/ 先将最底层圆盘之上的圆盘看做一个整体。汉诺塔问题的本质是 将最底层圆盘之上的圆盘全部放到辅助柱上 将最底层圆盘放到目标柱上 递归地处理辅助柱上的圆盘 而第一步又可以变成一个目标柱为辅助柱的汉诺塔问题,即sel 阅读全文
posted @ 2020-07-31 14:14 luozx207 阅读(612) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof/ 朴素遍历法 class Solution(object): def minArray(self, numbers): """ :type numbe 阅读全文
posted @ 2020-07-22 14:17 luozx207 阅读(121) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/is-graph-bipartite/ 动态维护A、B集合算法 class Solution(object): def isBipartite(self, graph): """ :type graph: List[List[int] 阅读全文
posted @ 2020-07-16 11:23 luozx207 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 使用 应从django模块引入配置: from django.conf import settings 而不是直接从项目文件中引入 from proj import settings 直接从项目文件中引入会破坏app的独立性。比如我想要把proj项目中的支付模块pay_app分离出去,就要修改所有p 阅读全文
posted @ 2020-06-29 19:18 luozx207 阅读(1522) 评论(0) 推荐(2) 编辑
摘要: https://leetcode-cn.com/problems/ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof/ 递归。 将数字转换为字符串s。翻译字符串s时,我们有两个选择: 选择将第一位数字翻译成字符。然后翻译剩下的s[1:] 选择将前两位数字翻译成字符。然后翻 阅读全文
posted @ 2020-06-28 17:40 luozx207 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 为什么在URL中的字符需要被编码 因为URL参数字符串中使用key=value键值对这样的形式来传参,键值对之间以&符号分隔,如果参数中有"="或"&"则会引起误解 如何编码 使用urllib.parse的quote和unquote方法,如: >>> quote("环==//()WLKJLI__.. 阅读全文
posted @ 2020-06-18 18:01 luozx207 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 一些非常恐怖的接口不但不传json,还搞些奇奇怪怪的分隔符,比如: 每条记录用 Chr(10)分隔,每列用\n 分隔 chr(10)不就是换行符"\n"吗?这两者有什么区别? 实际拿到数据,print出来是这样的: Avalue1\nAvalue2\nAvalue3 Bvalue1\nBvalue2 阅读全文
posted @ 2020-06-18 10:10 luozx207 阅读(1224) 评论(0) 推荐(0) 编辑
摘要: python3与python2的区别 Python2 的默认编码是 asscii,这也是导致 Python2 中经常遇到编码问题的原因之一 Python 3 默认采用了 UTF-8 作为默认编码,因此不再需要在文件顶部写 # coding=utf-8 了 # python2.7 >>> sys.ge 阅读全文
posted @ 2020-06-15 11:14 luozx207 阅读(180) 评论(0) 推荐(0) 编辑
摘要: https://leetcode cn.com/problems/find the longest substring containing vowels in even counts/ 这题真的太难了,看答案都想了两个小时,我建议调整难度为困难不过分吧?orz 时间复杂度:O(n) 空间复杂度:O 阅读全文
posted @ 2020-05-20 17:20 luozx207 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 一切变量皆是对象的引用 当创建对象时, Python 立即向操作系统请求内存 可以用id(变量名)来获取该变量所引用对象的内存地址 is关键字用于判断引用是否相同,==用于判断引用的内容是否相同 在Python中,整数和短小的字符,Python都会缓存这些对象,以便重复使用。当我们创建多个等于“12 阅读全文
posted @ 2020-05-19 17:46 luozx207 阅读(204) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页