Roblox interview question

Sub Palindrome Problem from leetcode