How To Write Solution In Leetcode Problems On Strings