12
返回列表 发新帖
楼主: 皮蛋豆腐
跳转到指定楼层
上一主题 下一主题
收起左侧

Airbnb 跪经

🔗
ipure 2016-5-26 05:55:26 | 只看该作者
全局:
楼主 能不能讲讲design细节怎么问的, 是backend还是frontend, 是要整套系统符合国际化么
回复

使用道具 举报

🔗
 楼主| 皮蛋豆腐 2016-5-26 07:43:41 | 只看该作者
全局:
ipure 发表于 2016-5-26 05:55
楼主 能不能讲讲design细节怎么问的, 是backend还是frontend, 是要整套系统符合国际化么

问的非常笼统,需要你自己去clarify
回复

使用道具 举报

🔗
kayv 2016-5-26 09:45:35 | 只看该作者
全局:
dfs+字典树应该可以,字典树快速判断是否可行
回复

使用道具 举报

🔗
wizardchen 2016-6-11 00:05:57 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

🔗
18658109706 2016-8-23 04:46:19 | 只看该作者
全局:
问一下,onsite也是直接写直接跑吗?还是白板写呀
回复

使用道具 举报

🔗
hardy616 2016-8-24 07:39:51 | 只看该作者
全局:
我也写一个trie+dfs的穷举

  1. public class Solution {
  2.     public String longest = "";

  3.     public static void main(String[] args) {
  4.         String[] dict = {"abcddd","abc"};
  5.         char[][] mat = {{'a','b','c'},{'d','d','d'},{'b','b','d'}};
  6.         Solution sol = new Solution();
  7.         sol.findmaxPath(dict, mat);
  8.         System.out.println(sol.longest);

  9.         String[] dict2 = {"abs","abc","dd","bb"};
  10.         sol = new Solution();
  11.         sol.findmaxPath(dict2, mat);
  12.         System.out.println(sol.longest);
  13.     }

  14.     public void findmaxPath(String[] dict, char[][] mat) {
  15.         Trie trie = new Trie();
  16.         for (String s : dict) {
  17.             trie.insert(s);
  18.         }

  19.         int rows = mat.length;
  20.         int cols = mat[0].length;
  21.         boolean[][] taken = new boolean[rows][cols];

  22.         for (int row = 0; row < rows; row++) {
  23.             for (int col = 0; col < cols; col++) {
  24.                 recursiveHelper(trie, mat, row, col, taken, "", "");
  25.             }
  26.         }
  27.     }

  28.     private void recursiveHelper(Trie trie, char[][] mat, int row, int col, boolean[][] taken, String prev, String current) {
  29.         int rows = mat.length;
  30.         int cols = mat[0].length;

  31.         if (row < 0 || col < 0 || row >= rows || col >= cols || taken[row][col]) {
  32.             return;
  33.         }

  34.         char ch = mat[row][col];
  35.         taken[row][col] = true;
  36.         current += ch;

  37.         // Case 1 : use 'current' as the end of the prefix
  38.         if (trie.search(current)) {
  39.             if ((prev + current).length() > this.longest.length()) {
  40.                 this.longest = prev + current;
  41.             }

  42.             recursiveHelper(trie, mat, row + 1, col, taken, prev + current, "");
  43.             recursiveHelper(trie, mat, row - 1, col, taken, prev + current, "");
  44.             recursiveHelper(trie, mat, row, col + 1, taken, prev + current, "");
  45.             recursiveHelper(trie, mat, row, col - 1, taken, prev + current, "");
  46.         }

  47.         // Case 2 : use 'current' as the start of the suffix
  48.         // e.g. we should match 'abcddd' instead of 'abc' in dict
  49.         if (trie.startsWith(current)) {
  50.             recursiveHelper(trie, mat, row + 1, col, taken, prev, current);
  51.             recursiveHelper(trie, mat, row - 1, col, taken, prev, current);
  52.             recursiveHelper(trie, mat, row, col + 1, taken, prev, current);
  53.             recursiveHelper(trie, mat, row, col - 1, taken, prev, current);
  54.         }

  55.         taken[row][col] = false;
  56.     }
  57. }
复制代码
回复

使用道具 举报

🔗
iamafrican 2016-12-29 11:27:21 | 只看该作者
全局:
请问最后path是像一笔画一样吗?如果是断开的但是单词最多可以吗?
回复

使用道具 举报

🔗
shelly1996 2016-12-31 02:38:20 | 只看该作者
全局:
同问楼主,path里如果断开的单词最多可以么,一定要连在一起么
回复

使用道具 举报

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

本版积分规则

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