📣 独立日限时特惠: VIP通行证立减$68
123
返回列表 发新帖
楼主: xixixi
跳转到指定楼层
上一主题 下一主题
收起左侧

求pocket gems onsite 面经

 
🔗
anonym 2015-2-25 11:20:37 | 只看该作者
全局:
DQ总是重名 发表于 2015-1-8 00:55
我感恩节之前去面的onsite,记得考了word break和一个游戏设计题,设计题我感觉挺难,应该是他们现在正在设 ...

请问他家on-site的时候是白板写还是在电脑上敲啊 还没有过on-site经验
回复

使用道具 举报

全局:
anonym 发表于 2015-2-25 11:20
请问他家on-site的时候是白板写还是在电脑上敲啊 还没有过on-site经验

我是用白板的
回复

使用道具 举报

🔗
tonywen2014 2015-2-25 11:45:20 | 只看该作者
全局:
楼主还有二面的代码吗?求一份啊!
回复

使用道具 举报

全局:
xixixi 发表于 2015-1-17 08:24
第一面和地里其它面经一样,strstr,top k most frequent number。我现在在外面等回头给你发第二面代码吧

你好,strstr要求kmp吗?
回复

使用道具 举报

🔗
nathanwong 2015-4-1 11:42:46 | 只看该作者
全局:
呆呀猛的 发表于 2015-2-14 01:40
那可以麻烦你把代码发我一下吗, 感激不尽呀!

请问lz发的那个能给我发一份看看么?打算要面一下 多谢了
回复

使用道具 举报

🔗
haomin_zz 2015-4-4 06:49:40 | 只看该作者
全局:
楼主求1、2 面的代码。 刚约了一面,感觉大家都是找的fulltime, 我投的intern也不知道题会不会一样
回复

使用道具 举报

🔗
鱼吃鱼翅 2015-4-7 13:26:46 | 只看该作者
全局:
class GridPoint {
   int x;
   int y;
}

class Item {
   Color color;
}

class Match {
   GridPoint[] matchPoints;
   void removeMatchPoints();
   void addMatchPoint(GridPoint point);
}

class Game {
   Item[][] board;
   int boardWidth;
   int boardHeight;
   int currentScore;

   // this is the callback for user interaction
   void swap(GridPoint pointA, GridPoint pointB) {
       // points A and B will be adjacent
       Item originalItemAtPointA = board[pointA.x][pointA.y];
       board[pointA.x][pointA.y] = board[pointB.x][pointB.y];
       board[pointB.x][pointB.y] = originalItemAtPointA;
       List<Match> matches = getMatches();
       if (matches.length == 0) {
           board[pointB.x][pointB.y] = board[pointA.x][pointA.y];
           board[pointA.x][pointA.y] = originalItemAtPointA;
       }
       for (Match match in matches) {
           // match: 0,2; 0,1; 0,0

           boolean horizontal = false;
           boolean start = true;
           int x = 0, y = 0;
           int boundary = 0;
           for (GridPoint matchPoint in match.matchPoints) {
               if(start){
                   start = false;
                   x = matchPoint.x;
                   y = matchPoint.y;
               }else{
                   if(matchPoint.x != x){
                       horizontal = true;
                       break;
                   }
                   if(matchPoint.y > y){
                       boundary = y;
                       break;
                   }else y = matchPoint.y;   
               }
           }

           int index = 0;
           for (GridPoint matchPoint in match.matchPoints) {
               board[matchPoint.x][matchPoint.y] = null;
               currentScore++;
               if(horizontal){
                   index = matchPoint.y;
                   while(index > 0){
                       board[matchPoint.x][matchPoint.y] = board[matchPoint.x][index - 1];
                       index--;
                   }
                   board[matchPoint.x][0] = randomIterm();
               }
           }

           if(!horizontal){
               while(index >= boundary){
                       board[matchPoint.x][matchPoint.y] = board[matchPoint.x][index - 1];
                       index--;
                   }
                   board[matchPoint.x][0] = randomIterm();
           }
       }
       if (currentScore >= 3) {
           win(currentScore);
       }
   }

   List<Match> getMatches() {
       List<Match> foundMatches = new List<Match>();
       foundMatches.append(getHorizontalMatches());
       foundMatches.append(getVerticalMatches());
       return foundMatches;
   }

   List<Match> getHorizontalMatches() {
       List<Match> foundMatches = new List<Match>();
       Match match = new Match();
       for (int y = 0; y < boardHeight; y++) {
           int x = 0;
           GridPoint startingGridPoint = nil;
           Item startingItem = nil;
           match.removeMatchPoints();
           while (x < boardWidth) {
               if (x < boardWidth && startingGridPoint == nil) {
                   startingGridPoint = new GridPoint(x, y);
                   startingItem = board[x][y];
                   if (startingItem) {
                       match.addMatchPoint(startingGridPoint);
                   }
                   x++;
               } else {
                   GridPoint nextGridPoint = new Pair(x, y);
                   Item nextItem = board[x][y];
                   if (startingItem && nextItem && nextItem.color.isEqual(startingItem.color)) {
                       match.addMatchPoint(nextGridPoint);
                       x++;

                   }else if(startingItem && nextItem && !nextItem.color.isEqual(startingItem.color)){
                       if (match.matchPoints.length >= 3) {
                           foundMatches.append(match);
                       }
                       match = new Match();
                       startingGridPoint = nil;
                       startingItem = nil;
                   }
                   else {
                       match = new Match();
                       startingGridPoint = nil;
                       startingItem = nil;
                   }
               }
           }
           if (match.matchPoints.length >= 3) {
               foundMatches.append(match);
           }
       }
       return foundMatches;
   }

   List<Match> getVerticalMatches() {
       ...
   }
}

---------------------------------------------------------------------------------------------------------

1) This implements a simple game. What is the name of the game, or if you don't know, how does the game work?

http://bejeweled.popcap.com/html5

2) Right now the game only handles matches of exactly 3. Please extend the solution to find the longest
matches possible with a minimum of 3.

3) Extend this to automatically drop gems (cascade) into empty spots and prepare the board for the next play.
回复

使用道具 举报

🔗
鱼吃鱼翅 2015-4-7 13:28:28 | 只看该作者
全局:
我发在这了,要不给你们发邮件太累啦。。。好多好多好多好多人问我。。。不过说实话我觉得我这样做不太好,但pcket jem没让签NDA哈
回复

使用道具 举报

🔗
Hailey1989 2015-4-10 23:32:18 | 只看该作者
全局:
鱼吃鱼翅 发表于 2015-4-7 13:28
我发在这了,要不给你们发邮件太累啦。。。好多好多好多好多人问我。。。不过说实话我觉得我这样做不太好, ...

多谢!请问一下,贴出来的这段代码里面有你自己改写的部分是吗?
回复

使用道具 举报

🔗
anastasia22 2015-4-18 08:40:57 | 只看该作者
全局:
xixixi 发表于 2015-1-8 05:23
我面的不是这个,是glassdoor上那个match color的题目。就是简化的candy crash。原来是match 3个就行,让 ...

今天面了一面,想一起讨论下candy crush那个题目,我扣扣是10805529哦,加我哈
回复

使用道具 举报

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

本版积分规则

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