随笔分类 -  逻辑题

摘要:编写函数,实现功能:将[1,2,[3,[4,5]],6,[7,]] 转换成[1,2,3,4,5,6,7] [1,2,[3,[4,5]],6,[7,]] 用生成器将其生成[1,2,3,4,5,6,7] 编写代码实现func函数,使其实现以下效果:foo = func(8)print(foo(8)) # 阅读全文
posted @ 2018-10-15 08:47 st--st
摘要:给定一个整数数组和一个目标值,找出数组中和为目标值的两个数。 你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用。 示例: 答案: class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type 阅读全文
posted @ 2018-09-02 19:57 st--st 阅读(96) 评论(0) 推荐(0)