Fixed small typo
Unit test for the optimized solution
Improved solution