本文发表在 rolia.net 枫下论坛Here is a quiz: There are 8 balls of the same size and color. One of the balls is heavier than others. Given a scale, how many times do you need to weigh these balls to identify that heavier one?
If you are asked similar questions in a job interview, you should be careful. It is not easy to come up with an optimal answer. It seems to me that the answer itself is not very important at all.
I was asked a similar question in my most recent job interview. I told the person who asked the question, "I'm not smart enough to jump to the optimal anaswer. As I a programmer, I need to take a systematic approach. First of all, I need to carefully understand your problem. I would like to put it into a module and define a flexible interface. I will make my module applicable not only to your special case, but also to the generale case. Then, I am gonna implement a not-smart solution so that the possible user of my module can have something at hand. Then, I am gonna drill down and try to optimize my solution. But this should be transparent to the user. I hope this is a more reasonable approach to the problem."
Usually, if you have a problem, we can give an answer. Then, we need to refine our solution. This process is called optimization in the software engineering. The better, more economical, and more efficient solution is called the optimal solution.
I know a lot of programmers know these trivia.更多精彩文章及讨论,请光临枫下论坛 rolia.net
If you are asked similar questions in a job interview, you should be careful. It is not easy to come up with an optimal answer. It seems to me that the answer itself is not very important at all.
I was asked a similar question in my most recent job interview. I told the person who asked the question, "I'm not smart enough to jump to the optimal anaswer. As I a programmer, I need to take a systematic approach. First of all, I need to carefully understand your problem. I would like to put it into a module and define a flexible interface. I will make my module applicable not only to your special case, but also to the generale case. Then, I am gonna implement a not-smart solution so that the possible user of my module can have something at hand. Then, I am gonna drill down and try to optimize my solution. But this should be transparent to the user. I hope this is a more reasonable approach to the problem."
Usually, if you have a problem, we can give an answer. Then, we need to refine our solution. This process is called optimization in the software engineering. The better, more economical, and more efficient solution is called the optimal solution.
I know a lot of programmers know these trivia.更多精彩文章及讨论,请光临枫下论坛 rolia.net