Return a tuple (b, a) when given two integers a and b >>> swap(2,3) (3, 2) >>> swap(3,4) (4, 3) >>> swap(67, 12) (12, 67) >>> swap(3,-4) (-4, 3)
(a: int, b: int)
| 7 | |
| 8 | |
| 9 | def swap(a: int, b: int) -> tuple[int, int]: |
| 10 | """ |
| 11 | Return a tuple (b, a) when given two integers a and b |
| 12 | >>> swap(2,3) |
| 13 | (3, 2) |
| 14 | >>> swap(3,4) |
| 15 | (4, 3) |
| 16 | >>> swap(67, 12) |
| 17 | (12, 67) |
| 18 | >>> swap(3,-4) |
| 19 | (-4, 3) |
| 20 | """ |
| 21 | a ^= b |
| 22 | b ^= a |
| 23 | a ^= b |
| 24 | return a, b |
| 25 | |
| 26 | |
| 27 | def create_sparse(max_node: int, parent: list[list[int]]) -> list[list[int]]: |
no outgoing calls
no test coverage detected