Shortest distance between two arrays
Given two sorted array in non-descending order, each contains positive integers
The distance is define as following
pick up a number from each array, compute their difference
return the shortest distance among them-that's the distance between the two arrays
example
int[] a = {1, 3, 5, 7 , 9} ;
int[] b = {2, 4, 8} ;
The result is 1
Code
作者:zdd
出处:http://www.cnblogs.com/graphics/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.