🎁 Offer多多申请季白金卡十一特惠52% off! 🎁
<
回复: 12
收起左侧

vmturbo 机经

|只看干货
本楼: 👍   100% (1)
 
 
0% (0)   👎
全局: 👍   96% (159)
 
 
3% (5)    👎

2015(4-6月) 码农类General 本科 全职@vmturbo - 网上海投 - 在线笔试  | Other | 应届毕业生

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
1.You're asked to write a controller for a sorting machine for Christmas decorations.  
Decorations arrive at the scanner, and the percentages of red and green are reported.  
Your must write a program that sorts the decorations into one of three bins:

Red, if the decoration is more than 35% red
Green, if the decoration is more than 30% green
Reject, if the decoration is both more than 35% red and 30% green - these are just too "loud".

The interfaces you have are the following:

interface ScannerAndSorter {
        // Read and scan another item; return false when there are no more
        // items.
        bool nextItem();

        // Percentage (0-100) of the current item that's red.
        double redPercentage();

        // Percentage (0-100) of the current item that's green.
        double greenPercentage();

        // Send the current item to the Red bin
        void sendToRed();

        // Send the current item to the Green bin
        void sendToGreen();

        // Send the current item to the Reject bin
        void reject();
}

class DecorationSorter {
        ScannerAndSorter sorter;

        public DecorationSorter(ScannerAndSorter sorter) {
                this.sorter = sorter;
        }

        // Sort the decorations that 'sorter' reads.
        void sort() {
                ... fill this in ...
        }
}


Implement the sort() function.

2.A maze is a group of linked Places.  Each Place has a North, South, East, and West Place adjacent to it.  There are two special pre-defined Place's:  
Place Wall represents a wall - the mouse can't go there.  Place Cheese is ... cheese!   The connections between Places are symmetrical - if you start
from any Place and go North and then South, you return to where you were.  To simplify things, the maze has no closed loops - that is, if you start in
any Place and follow any path, yo
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
int, will reach a Place where isCheese() is
  // true.  Return null if you can't find such a path.
  public String findCheese(Place startingPoint) {
        ... fill this in ...
  }
}

Implement findCheese().  You can add any fields or helper methods you need to Mouse.


Extra credit:  Eliminate the "no closed loops" restriction.  That is, change
your code so that it works correctly even if there might be a path like SSNEEW that leads the mouse back to the Place it started from.

评分

参与人数 3大米 +11 收起 理由
ybxsnail + 5 great!!
calvinq + 3 nice
yabay91 + 3 感谢分享!

查看全部评分


上一篇:Epic OA
下一篇:Zenefits 电面
 楼主| ice9123 2015-4-19 21:28:45 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   96% (159)
 
 
3% (5)    👎
woshiee123 发表于 2015-4-19 02:09
那item的class 也没给么 ?item就是item.color 么? 需要一个变量sum么?还是不用自己算 直接有百分比

interface 里的方法都可以直接用,没有满足的条件就 nextItem。直接用给的方法,不用考虑具体是怎么实现的
回复

使用道具 举报

woshiee123 2015-4-19 22:07:56 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   100% (5)
 
 
0% (0)    👎
ice9123 发表于 2015-4-19 21:28
interface 里的方法都可以直接用,没有满足的条件就 nextItem。直接用给的方法,不用考虑具体是怎么实现 ...

可以用c++么 还是必须用java
扫码关注一亩三分地求职移民公众号
更多干货内容等你发现
回复

使用道具 举报

woshiee123 2015-4-19 02:09:21 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   100% (5)
 
 
0% (0)    👎

那item的class 也没给么 ?item就是item.color 么? 需要一个变量sum么?还是不用自己算 直接有百分比
回复

使用道具 举报

woshiee123 2015-4-18 23:11:48 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   100% (5)
 
 
0% (0)    👎
问下这个题如果第一个item 即《35red 也小于30 green 如何操作 ?
回复

使用道具 举报

 楼主| ice9123 2015-4-19 01:26:49 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   96% (159)
 
 
3% (5)    👎
woshiee123 发表于 2015-4-18 23:11
问下这个题如果第一个item 即《35red 也小于30 green 如何操作 ?

什么都不做
回复

使用道具 举报

woshiee123 2015-4-20 23:05:14 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   100% (5)
 
 
0% (0)    👎
woshiee123 发表于 2015-4-19 22:07
可以用c++么 还是必须用java

这个OA是要编译通过的么
回复

使用道具 举报

 楼主| ice9123 2015-4-21 21:37:51 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   96% (159)
 
 
3% (5)    👎
woshiee123 发表于 2015-4-20 23:05
这个OA是要编译通过的么

不需要,就是一个写字板
回复

使用道具 举报

qwert1234567 2015-4-28 08:07:44 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   95% (23)
 
 
4% (1)    👎
楼主有消息了么?
回复

使用道具 举报

 楼主| ice9123 2015-5-13 02:13:20 | 显示全部楼层
本楼: 👍   0% (0)
 
 
0% (0)   👎
全局: 👍   96% (159)
 
 
3% (5)    👎
ffcc 发表于 2015-4-28 08:07
楼主有消息了么?

没有,一个多月了。估计是跪了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表