hackerrank---Sets - Symmetric Difference
集合操作
附上代码:
M = int(input())
m = set(map(int, raw_input().strip().split()))
N = int(input())
n = set(map(int, raw_input().strip().split()))
tmp = sorted(m.union(n).difference(m.intersection(n)))
for i in xrange(len(tmp)):
print tmp[i]
hackerrank---Sets - Symmetric Difference的更多相关文章
- FCC高级编程篇之Symmetric Difference
Symmetric Difference Create a function that takes two or more arrays and returns an array of the sym ...
- js-FCC算法-Symmetric Difference
创建一个函数,接受两个或多个数组,返回所给数组的 对等差分(symmetric difference) (△ or ⊕)数组. 给出两个集合 (如集合 A = {1, 2, 3} 和集合 B = {2 ...
- FCC(ES6写法) Symmetric Difference
创建一个函数,接受两个或多个数组,返回所给数组的 对等差分(symmetric difference) (△ or ⊕)数组. 给出两个集合 (如集合 A = {1, 2, 3} 和集合 B = {2 ...
- [Advanced Algorithm] - Symmetric Difference
题目 创建一个函数,接受两个或多个数组,返回所给数组的 对等差分(symmetric difference) (△ or ⊕)数组. 给出两个集合 (如集合 A = {1, 2, 3}和集合 B = ...
- Symmetric Difference FreeCodeCamp
function sym(args) { var arr = Array.prototype.slice.call(arguments); return arr.reduce((arr1, arr2) ...
- Symmetric Difference
function sym(args) { //return args; var arr = []; for(var i = 0; i < arguments.length; i++){ arr. ...
- python3 第十五章 - 数据类型之Sets(集合)
python的官网里对集合的描述是: Python also includes a data type for sets. A set is an unordered collection with ...
- Symmetric Difference-freecodecamp算法题目
Symmetric Difference 1.要求 创建一个函数,接受两个或多个数组,返回所给数组的对等差分(symmetric difference) 例子:给出两个集合 (如集合 A = {1, ...
- Python高手之路【三】python基础之函数
基本数据类型补充: set 是一个无序且不重复的元素集合 class set(object): """ set() -> new empty set object ...
随机推荐
- 44个 Javascript 变态题解析 (下)
承接上篇 44个 Javascript 变态题解析 (上) 第23题 [1 < 2 < 3, 3 < 2 < 1] 这个题也还可以. 这个题会让人误以为是 2 > 1 & ...
- Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
WARN: SQL Error: , SQLState: HY000 八月 , :: 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logEx ...
- Python数据分析入门与实践
Python数据分析入门与实践 整个课程都看完了,这个课程的分享可以往下看,下面有链接,之前做java开发也做了一些年头,也分享下自己看这个视频的感受,单论单个知识点课程本身没问题,大家看的时候可以关 ...
- Vue. 之 Element dialog 拖拽
Vue. 之 Element dialog 拖拽 默认情况下,在使用Element的Dialog模块时,弹出框是不能移动的,且 一旦点击遮罩层区域,弹框就会消失. 解决方案: 1 在 utils 中新 ...
- chgrp权限命令
功能说明:变更文件或目录的所属群组. 语 法:chgrp [-cfhRv][--help][--version][所属群组][文件或目录...] 或 chgrp [-cfhRv][--help][-- ...
- Leetcode153. Find Minimum in Rotated Sorted Array寻找旋转排序数组中最小值
假设按照升序排序的数组在预先未知的某个点上进行了旋转. ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] ). 请找出其中最小的元素. 你可以假设数组中不存在重 ...
- VS2013生成、使用dll,lib文件
VS2013生成DLL文件 vs2013创建及使用DLL 一般来说项目偏爱生成dll动态库文件,因为可以解决静态库造成的空间浪费和更新困难问题,另外创建静态库时,我一般是建立空项目后,在项目配置类型中 ...
- 洛谷2593 [ZJOI2006]超级麻将——可行性dp
题目:https://www.luogu.org/problemnew/show/P2593 发现三个连续牌的影响范围只有3.相同牌的影响范围只有1之后就可以dp了. O(100^7)T飞. #inc ...
- leetcode 563 - 653
563. Binary Tree Tilt Input: 1 / \ 2 3 Output: 1 Explanation: Tilt of node 2 : 0 Tilt of node 3 : 0 ...
- Eclipse安装FindBugs
Eclipse安装FindBugs 1.使用Eclipse的help在线安装,安装地址” FindBugs - http://findbugs.cs.umd.edu/eclipse-daily“. 2 ...