MathWorks interview question

Discuss how to implement diff algorithm.