Well, it's, you sort of know how you'd do it if this was grammar school right?
你怎么解决这个问题呢?,很简单?
How can I solve this problem?
我该怎么解决这个问题呢?
All right. So it's fun, and I got a little bit of applause out of it, which is always nice for me, but I also showed you how to think about it recursively.
好,挺有趣的,我也得到了一点掌声,这让我挺高兴的,但是我想让大家明白,怎么用迭代的思想来解决这个问题。
And then remember how you solve this 'cause otherwise completely useless exercise.
记住我是怎么解决这个问题的,否则就是一次,无意义的演练了,对吧。
How do we solve this problem?
我们要怎么解决这个问题呢
What remedies do we see?
我们怎么解决这个问题
Not so easy to see. All right, but this is actually a great one of those educational moments. This is a great example to think recursively. If I wanted to think about this problem recursively- what do I mean by thinking recursively?
看不太出来,好,但实际上是一个有教育意义的时刻,这是一个很好的关于递归的例子,如果我用递归的思想,去考虑这个问题-,我该怎么用递归去解决这个问题呢?
OK. So that then leads to the question about what should we do about this?
那我们应该怎么去,解决这个问题呢?
Just to think about how I would break that problem up.
然后想想该怎么,解决这个问题。
So what can we do to solve this?
来解决这个问题,我们能怎么做?
I'm given an integer that's a perfect square, and I want to write a little piece of code that's going to find the square root of it. All right so I'm cheating a little, I know it's a perfect square, somebody's given it to me, we'll come back in a second to generalizing it, so what would the steps be that I'd use to walk through it?
完美平方数的整数,我想写一段代码来求这个数的平方根,好,我这儿有点儿作弊了,我知道这是一个完美的平方数了,他们给我的,我们后面会讲怎么产生这个数的,那么我想解决这个问题,需要什么步骤呢?
So now we're left with a problem that's but 500 pages large and so what might a human do now to find Mike even more closely?
现在我们只用翻500页就能解决问题了,接下来,怎么做才能离Mike这个名字更近一步?
So how would we go about solving this problem if I told you not only was there a maximum weight, but there was a maximum volume. Well, we want to go back and attack it exactly the way we attacked it the first time, which was write some mathematical formulas.
有些时候两个都重要,所以如果我告诉你这里不仅有,最大重量还有最大容量,我们应该怎么解决这个问题呢?,好了,我们想回过来然后,和第一次一样看看这个问题。
应用推荐