Leetcode DP problem

I have written the code and got submitted it successfully but I guess it can be optimized using MEMOIZATION but I am failing to do so plz help me to memorize my code—>
problem link—> https://leetcode.com/problems/count-sorted-vowel-strings/

my solution code—>

you have to just observe the pattern formed

Reference Code

Yeah pattern thing is also good but since it was DP and backtracking ques so my method makes more sense but I was not able to do memorization for optimization therefore seeking for help

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.