题目
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201219021433237.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3ODIxNzAx,size_16,color_FFFFFF,t_70)
题目链接:https://leetcode-cn.com/problems/smallest-difference-lcci/
解法1:排序+双指针
class Solution:
def smallestDifference(self, a: List[int], b: List[int]) -> int:
a.sort()
b.sort()
p1 = p2 = 0
ans = float('inf')
while p1<len(a) and p2<len(b):
diff = abs(a[p1]-b