Video solution with explanation (C++): https://youtu.be/2F1cRSBCDJ4
Need one video editorial for EDGEDIR.