PALINDROMIC PATITIONING

Q- PALINDROMIC PATITIONING
my sol- https://ide.codingblocks.com/s/606829

could you please explain the further optimised approach?