关于这个高级Ruby on Rails面试问题的想法?
正在寻找Rails工作;昨天参加了一个面试。一般来说,我不太参加这种类型的面试,但这次我想尝试一下,看看自己能做到什么(结果我失败了,没能在时间结束前找到一个可行的解决方案)。
以下是题目内容:
想象一下,你住在纽约市,你的工作是用车送披萨。披萨有三种不同的尺寸:小、中、大。你的车有一定的披萨承载能力,其中小披萨占用一个单位的容量,中披萨占用两个单位,大披萨占用三个单位。你会收到一个订单列表,每个订单都定义了需要送达的每种尺寸的披萨数量。每位顾客希望在一次送货中收到他们的全部订单。你必须按顺序送达这些订单。假设你的车只有足够的燃料进行T次行程。那么,送达所有订单所需的最小车载容量是多少?
要求:
时间:50分钟
交付物:一个可行的解决方案,经过打磨以适合生产使用
没有测试用例。没有示例。请提前想好这些。
别误会,我觉得这个练习很有趣,面试官沟通能力很好,表达清晰,在我面前挑战我的思维也很有趣 :D。我只是想知道,这种类型的问题在你所在的地方是否在Rails面试中很常见。
查看原文
On the lookout for a Rails job; got this yesterday. Generally I don't do these kind of interviews but for once I wanted to have some fun to see how I'd do (I failed. Didn't reach a working solution) when time run out.<p>Here you go:<p>Imagine you live in New York City, and your job is to deliver pizzas using your car. The pizzas come in three different sizes: small, medium, and large. Your car has a certain pizza carrying capacity, where a small pizza takes one unit of capacity, medium takes two units, and large takes three units. You are given a list of orders to deliver, where each order is defined as the amount of each size of pizza to deliver. Each customer expects to receive the entirety of their order in a single delivery. You must deliver the orders in order. Say your car only has enough fuel to make T trips. What is the minimum car capacity necessary to deliver all of the orders?<p>Requirements:<p>Time: 50mins
Deliverable: A working solution, polished for production
No test cases. No examples. Come up with these upfront.<p>Don't get me wrong. It was fun doing the exercise, the interviewer was a good communicator, spoke clearly and was fun cracking my brain before him :D. I'm just wondering if these types of questions for Rails are common wherever you are.