`

[待续]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:

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics