关于这个高级 Ruby on Rails 面试题的看法?
1 分•作者: siaw23•9 个月前
正在寻找一份 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.