楼主: max_random
跳转到指定楼层
上一主题 下一主题
收起左侧

Google, Facebook, Twitter, Amazon, Square, Zillow, YP, Bloomreach 面经

   
🔗
xiaohl0913 2015-11-11 14:01:53 | 只看该作者
全局:
祝工作顺利!
回复

使用道具 举报

🔗
HML0622 2015-11-16 14:32:16 | 只看该作者
全局:
楼主棒棒哒~··顶!顶!顶!
回复

使用道具 举报

🔗
HML0622 2015-11-16 14:33:39 | 只看该作者
全局:
楼主··`第一条链接打不开啊··~

点评

要翻墙的  发表于 2015-11-19 13:22
回复

使用道具 举报

🔗
HML0622 2015-11-19 15:29:48 | 只看该作者
全局:
HML0622 发表于 2015-11-16 14:33
楼主··`第一条链接打不开啊··~

好的好的~
回复

使用道具 举报

🔗
fromemories1 2015-11-29 14:21:19 | 只看该作者
本楼:
全局:
mark~~~~~~~~~~~~~
回复

使用道具 举报

🔗
bobzhang2004 2015-12-12 03:20:10 | 只看该作者
全局:
写了下shuffle. 输入是[0,2,_,3] 输出是[0,_,2,3].
  1. public class SortWithBlank {

  2.         public static void main(String[] args) {
  3.                 int[] arr = {-1, 3, 2, 1};
  4.                 sortUsingBlank(arr, 0);
  5.                 for (int i : arr) {
  6.                         System.out.print(i + " ");
  7.                 }
  8.         }
  9.         //0 1 2 -1
  10.         public static void sortUsingBlank(int[] arr, int pos) {
  11.                 if (arr == null || arr.length == 0) {
  12.                         return;
  13.                 }
  14.                 for (int i = 0; i < arr.length; i++) {
  15.                         if (i == pos) {
  16.                                 continue;
  17.                         }
  18.                         int val = arr[i];
  19.                         if (val >= 0 && val < arr.length && arr[val] != val) {
  20.                                 pos = swap(arr, val, i, pos);
  21.                         }
  22.                 }
  23.         }

  24.         private static int swap(int[] arr, int j, int i, int pos) {
  25.                 if (j == pos) {
  26.                         arr[j] = arr[i];
  27.                         arr[i] = -1;
  28.                         return i;
  29.                 } else {
  30.                         arr[pos] = arr[i];
  31.                         arr[i] = arr[j];
  32.                         arr[j] = arr[pos];
  33.                         arr[pos] = -1;
  34.                         return pos;
  35.                 }
  36.         }
  37. }
复制代码
回复

使用道具 举报

🔗
bobzhang2004 2015-12-12 08:52:01 | 只看该作者
全局:
写了下jump iterator,还是有些tricky的。
  1. public class JumpIterator {

  2.         private Iterator<Integer> iterator;
  3.         private Integer next = null;
  4.         public JumpIterator(Iterator<Integer> ite) {
  5.                 this.iterator = ite;
  6.                 next = null;
  7.         }
  8.        
  9.         public int next() {
  10.                 if (next != null) {
  11.                         int res = next;
  12.                         next = null;
  13.                         return res;
  14.                 }
  15.                 if (iterator.hasNext()) {
  16.                         iterator.next();
  17.                         if (iterator.hasNext()) {
  18.                                 return iterator.next();
  19.                         }
  20.                 }
  21.                 return -1;
  22.         }
  23.         public boolean hasNext() {
  24.                 if (next != null) {
  25.                         return true;
  26.                 }
  27.                 if (iterator.hasNext()) {
  28.                         next = iterator.next();
  29.                         if (iterator.hasNext()) {
  30.                                 iterator.next();
  31.                         }
  32.                         return true;
  33.                 }
  34.                 return false;
  35.         }
  36.        
  37.         public static void main(String[] args) {
  38.                 List<Integer> list = new ArrayList<Integer>();
  39.                 list.add(1);
  40.                 list.add(2);
  41.                 list.add(3);
  42.                 list.add(4);
  43.                 list.add(5);
  44.                 list.add(6);
  45.                 list.add(7);
  46.                 JumpIterator ji = new JumpIterator(list.iterator());
  47.                 while (ji.hasNext()) {
  48.                         System.out.println(ji.next());
  49.                 }
  50.                
  51.         }
  52. }
复制代码
回复

使用道具 举报

🔗
luwenchaobh 2016-1-30 01:13:32 | 只看该作者
本楼:
全局:
此贴牛啊
回复

使用道具 举报

🔗
menlo 2016-3-5 09:03:16 | 只看该作者
全局:
好贴啊~还有update的么

点评

我都工作了快两年了.....没有参加面试, 开始面试别人了  发表于 2016-3-6 07:48
回复

使用道具 举报

🔗
aishan_leen 2016-5-5 09:01:47 | 只看该作者
全局:
楼主我想问new grad要交成绩单吗?
回复

使用道具 举报

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

本版积分规则

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