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

Zenefits onsite 面经

🔗
tiantiana 2015-9-27 03:56:31 | 只看该作者
全局:
NO.1 Question:

If use int array to represent big Int, one array can be 32 bigInt, right, since each int has 32 bits to assign to 32 bigInt for using.

Let's say the first int is 1011100010.....0010001 (32 bits), which means whether the 32 bigInts are negative or not.
                the second int is 1101000100010100 (32 bits), which means the lowest bits of 32 bitInts are 1 or 0.
   ...................................................
回复

使用道具 举报

🔗
tiantiana 2015-9-27 06:16:08 | 只看该作者
全局:
2. 给定两个date, 计算两个date之间的相差多少个星期

Thank lz for the mianjing!

how to answer this question? use java date type? how to detect which week the current date is in?

Thanks,
回复

使用道具 举报

🔗
ronaldo17 2015-10-29 09:16:40 | 只看该作者
全局:
请问lz,设计题有没有一些具体的要求?比如讨论数据库怎么设计,其他还有没有面试官要求考虑的点,比如query太频繁怎么scale之类的问题?谢谢啦
回复

使用道具 举报

🔗
nothingtrouble 2015-10-29 10:45:11 | 只看该作者
全局:
tiantiana 发表于 2015-9-27 06:16
2. 给定两个date, 计算两个date之间的相差多少个星期

Thank lz for the mianjing!

不知道有什么比较好的解法没有,我想的是,Date转成unix_timestamp,再算diff in days,然后算diff in weeks。
回复

使用道具 举报

🔗
nothingtrouble 2015-10-29 10:48:20 | 只看该作者
全局:
lz,你第三问用的dp吗? 我想了半天。用LC的Distinct Subsequences的方法写了一个:
  1. public static int count(String s, String t){
  2.         int i,j,i0,j0,k,ls=s.length(),lt = t.length();
  3.         int[][] dp = new int[ls+1][lt+1];
  4.         for(i=0;i<=ls;i++) dp[i][0] = 1;
  5.        
  6.         for(i=1;i<=ls;i++){
  7.                 i0=i-1;
  8.                 for(j=2;j<=lt;j+=2){
  9.                         j0=j-2;
  10.                         if(t.charAt(j0+1)=='+') k=2;
  11.                         else k=4;
  12.                         String tt = buildStr(t, j0);
  13.                         if(i0-k+1>=0 && s.substring(i0-k+1, i0+1).equals(tt)){
  14.                                 dp[i][j] = dp[i-1][j] + (j<2?1:dp[i-k][j-2]);
  15.                         } else dp[i][j] = dp[i-1][j];
  16.                 }
  17.         }
  18.         return dp[ls][lt];
  19. }
复制代码
回复

使用道具 举报

🔗
nothingtrouble 2015-10-29 10:48:35 | 只看该作者
全局:
lz,你第三问用的dp吗? 我想了半天。用LC的Distinct Subsequences的方法写了一个:
  1. public static int count(String s, String t){
  2.         int i,j,i0,j0,k,ls=s.length(),lt = t.length();
  3.         int[][] dp = new int[ls+1][lt+1];
  4.         for(i=0;i<=ls;i++) dp[i][0] = 1;
  5.        
  6.         for(i=1;i<=ls;i++){
  7.                 i0=i-1;
  8.                 for(j=2;j<=lt;j+=2){
  9.                         j0=j-2;
  10.                         if(t.charAt(j0+1)=='+') k=2;
  11.                         else k=4;
  12.                         String tt = buildStr(t, j0);
  13.                         if(i0-k+1>=0 && s.substring(i0-k+1, i0+1).equals(tt)){
  14.                                 dp[i][j] = dp[i-1][j] + (j<2?1:dp[i-k][j-2]);
  15.                         } else dp[i][j] = dp[i-1][j];
  16.                 }
  17.         }
  18.         return dp[ls][lt];
  19. }
复制代码
回复

使用道具 举报

🔗
aiuou 2015-10-31 07:18:56 | 只看该作者
全局:
大整数那个题不就是tiny url吗?
回复

使用道具 举报

🔗
aiuou 2015-11-2 13:20:57 | 只看该作者
全局:
aiuou 发表于 2015-10-31 07:18
大整数那个题不就是tiny url吗?

看错题了,掩面遁
回复

使用道具 举报

🔗
pennlio 2015-11-11 23:49:01 | 只看该作者
全局:
4题是不是要用dijkstra
回复

使用道具 举报

🔗
新屋熊 2015-11-13 15:40:12 | 只看该作者
全局:
第二题个人觉得应该是你自己知道今天的date跟礼拜几,利用跟第一个date的days diff,可以计算第一个date是礼拜几。知道了第一个date是礼拜几,知道第二个date,就能算出week diff.
回复

使用道具 举报

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

本版积分规则

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