Personal Capital interview question

coderpad: Leetcode problem - shortest distance to string