Modified DOTAA solution and optimized space complexity