LeetCode
来源:互联网 发布:视频教程网站源码 编辑:程序博客网 时间:2024/06/05 13:59
Q:
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
A:
class Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ if len(set(nums)) == len(nums): return False else: return True
阅读全文
0 0
- leetcode
- [leetcode]
- LeetCode
- leetcode
- leetcode
- leetcode:
- leetcode:
- LeetCode
- leetcode
- LEETCODE
- leetcode
- leetCode
- leetcode
- [leetcode]
- LeetCode
- leetcode
- leetcode:
- leetcode
- 框架漫谈之hibernate(一)为什么要使用hibernate框架
- weex仿新闻
- Spark example WordCount
- Spring08---AOP_基于xml
- CMD 命令速查手册
- LeetCode
- 帮朋友建了个电子书分享网站
- PAT
- Linux基本入门学习
- python matplotlib简单示例
- XML中特殊字符的处理
- NVIC 的抢占中断和响应中断
- 欢迎使用CSDN-markdown编辑器
- Xcode使用opencv的第一个程序