initial solution to min diff of 2 sorted arrays
refactoring search method
updated to use only immutable types