Apple interview question

How to implement a* routing