[待续]FaceBook interview - Zero or One Edit Distance

题目如下:

class IntFileIterator {
  boolean hasNext();
  int next();
}

class FileCompare {
  public boolean isDistanceZeroOrOne(IntFileIterator a, IntFileIterator b);
}
// return true if the distance between a and b is at most 1.
// Distance: minimum number of modifications to make a=b
// Modification:
//   1. change an int in a
//   2. insert an int to a
//   3. remove an int from a

  

Solution:

猜你喜欢

转载自yuanhsh.iteye.com/blog/2190881