📣 独立日限时特惠: VIP通行证立减$68
回复: 11
跳转到指定楼层
上一主题 下一主题
收起左侧

Airbnb 面经求问

全局:

2016(10-12月) 码农类General 硕士 全职@airbnb - 内推 - 其他  | | Other | 应届毕业生

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

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

x
有几道题想问下:

1. decode string  那道题,到底是什么意思呢?我总感觉这题有点简单的过分了吧?如果我把所有目标串里的大写改成小写,然后看这两个串一不一样不就可以了吗?

2.boggle game  
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
e/smiley/QQ/em34.gif" smilieid="112" border="0" alt="" />

上一篇:gg OA
下一篇:为什么我的亚麻oa是75min两道coding?
推荐
twfx1123 2016-11-1 12:11:39 | 只看该作者
全局:
第一题的自己刚才写了下,应该可以,供参考。第二题坐等大神!
  1. package bnb;
  2. import java.util.*;

  3. public class decodeURL {
  4.         public Integer decode(String testEncStr) {
  5.             String truth = "kljJJ324hijkS_";
  6.              
  7.             if (testEncStr.equals(truth)) {
  8.               return 848662;
  9.             } else {
  10.               return null;
  11.             }
  12.          }

  13.         public Integer decodeFind(String badEncStr){
  14.                 List<String> options = new ArrayList<String>();
  15.                 helper(badEncStr, options, 0);
  16.                
  17.                 for(String s : options){
  18.                         System.out.println(s+" ");
  19.                         if(decode(s) != null){
  20.                                 return decode(s);
  21.                         }
  22.                 }
  23.                 System.out.println("res length is" + options.size());
  24.                 return null;
  25.         }
  26.        
  27.         private void helper(String s, List<String> res, int start){
  28.                 if(start == s.length()){
  29.                         res.add(s);
  30.                         return ;
  31.                 }
  32.                 char[] arr = s.toCharArray();
  33.                
  34.                 if(Character.isLetter(arr[start])){
  35.                         char l = Character.toLowerCase(arr[start]);
  36.                         char u = Character.toUpperCase(arr[start]);
  37.                        
  38.                         String s1 = s.substring(0, start) + l + s.substring(start+1);
  39.                         helper(s1, res, start+1);
  40.                                        
  41.                         String s2 = s.substring(0,start) + u + s.substring(start+1);
  42.                         helper(s2, res, start+1);
  43.                 }
  44.                 else{
  45.                         helper(s, res, start+1);
  46.                 }
  47.         }
  48.        
  49.         public static void main(String[] args) {
  50.                 decodeURL du = new decodeURL();
  51. //                System.out.println("result is: " + du.decodeFind("kljJJ324hjkS_"));
  52.                 System.out.println("result is: " + du.decodeFind("123abc"));

  53.         }

  54. }
复制代码
回复

使用道具 举报

推荐
sophie729 2016-10-30 15:03:02 | 只看该作者
全局:
可以贴一下原版题目么 这个 不知道在说什么啊?
回复

使用道具 举报

无效楼层,该帖已经被删除
🔗
susand33 2016-10-31 02:15:35 | 只看该作者
全局:
第一题原题应该是这个,简单点就点简单呗。。
URL Shortener
/*
Often, we want to encode raw IDs in our database by hiding them behind some 2-way decodeable hash. So, a URL which would have at one time been:
https://www.airbnb.com/rooms/848662
becomes
https://www.airbnb.com/rooms/kljJJ324hjkS_
We decode the ID kljJJ324hjkS to 848662 on our backend and serve the relevant content. At some point, we start getting 404 errors from clients requesting a certain URL of the form
https://www.airbnb.com/rooms/kljjj324hjks
This can happen if certain clients, email services, or url shorteners "sanitize" the url. Unfortunately, this change breaks decoding and the resource cannot be found.
To assess how big of a deal this is, we may want to recover the IDs of the targets that were 404ing.
Given a method decode(testEncStr) which will return the decoded int id if testEncStr is decodeable or will throw an exception (or return null) if not, implement a new method decodeFind(String badEncStr) which takes a string and returns the decoded int id.


第二题boggle game是给你一个board还有字典,然后要求找出board上出现最多的字典单词,并且你找出来的单词集合里的每个字母都不能重叠在同一个位置。所以你要是找到了一个单词是airbnb,airbnb所在的board位置就不在再用了。return单词集合。然后不一定是一个path可以很多个不重叠的path。楼主要是知道怎么做求教。。 我当年被问过这题,妥妥的跪了,至今还不知道怎么做 > <
回复

使用道具 举报

🔗
Sayako 2016-11-1 12:55:39 | 只看该作者
全局:
boggle game是不是给个matri

补充内容 (2016-11-1 12:56):
手机打的怎么断了,给个matrix给个字典,让找最长的字典中word连起来的path,就像LC word break II的2D版?
回复

使用道具 举报

🔗
twfx1123 2016-11-1 13:05:09 | 只看该作者
全局:
Sayako 发表于 2016-10-31 20:55
boggle game是不是给个matri

补充内容 (2016-11-1 12:56):

目前我看到的有两种版本,一种是你所说的;另外一种呢 - 地里的人的描述:boggle game是给你一个board还有字典,然后要求找出board上出现最多的字典单词,并且你找出来的单词集合里的每个字母都不能重叠在同一个位置。所以你要是找到了一个单词是airbnb,airbnb所在的board位置就不在再用了。return单词集合。然后不一定是一个path可以很多个不重叠的path。
回复

使用道具 举报

🔗
Sayako 2016-11-1 22:41:53 | 只看该作者
全局:
gy21 发表于 2016-11-1 13:05
目前我看到的有两种版本,一种是你所说的;另外一种呢 - 地里的人的描述:boggle game是给你一个board还 ...

你说的和我说那个是一个啊。

补充内容 (2016-11-1 22:42):
要找最长的如果不是只有一个就是几个最长的长度相等,比较一下长度存起来就行了
回复

使用道具 举报

🔗
twfx1123 2016-11-2 00:00:15 | 只看该作者
全局:
Sayako 发表于 2016-11-1 06:41
你说的和我说那个是一个啊。

补充内容 (2016-11-1 22:42):

可是看你没有提到用过的字母不能再次使用以为说的是两道题目。
回复

使用道具 举报

🔗
fxjistc 2017-3-6 14:36:20 | 只看该作者
全局:
gy21 发表于 2016-11-1 12:11
第一题的自己刚才写了下,应该可以,供参考。第二题坐等大神!

求问这个做法时间复杂度是多少?
回复

使用道具 举报

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

本版积分规则

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