And now let's do one, a, two. Whoops.
它还告诉我这个数组是回文的?
Notice by the way, there's that nice speck true going on saying put a string here.
在这里说放一个字符串在这儿有点小问题,如果是回文的话那么它将会返回真值。
There's the base case. If it's longer than one, what do I want to do? Well I'd like to check the two end points to see are they the same character? And if they are, then oh, I just need to know is everything else in the middle a palindrome?
如果只有一个元素也是回文,这是基本事件,如果比一个长的话那么我应该怎么做?,我将会查看两头是否相同?,如果是的,我只要知道中间剩下的部分是不是回文即可?
It's not a palindrome.
数组不是回文的了。
Let me remind you.
是否还是一个回文呢?让我提醒你一下。
So let's try running Silly.
这个程序是用来测试一个数组是不是回文的。
And one is the third element. And just return, it's done. It is a palindrome. That make sense.
完成,数组时回文的,这就对了,因为数组1a1从前面和从后面读都是一样的。
应用推荐