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

Pinterest onsite

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

使用道具 举报

🔗
offer 2018-4-16 23:50:49 | 只看该作者
全局:
kinggarden2001 发表于 2018-3-27 04:03
我搞不懂问next permutation 有什么意义。难道要现推规则嘛?

同不懂 之前也面了这个组 也被问了这个题
回复

使用道具 举报

🔗
chw 2018-6-12 13:48:02 | 只看该作者
全局:
coding 2 应该是在问 Binomial 的 Normal approximation?
  1. from scipy.stats import norm

  2. def prob(L, N):
  3.     mu = 1.0 * N / L
  4.     sigma = N * (L - 1) / (L**2)
  5.     z_score = (0.5*N - mu) / sigma
  6.     return L * (1.0 - norm.cdf(z_score))

  7. if __name__ == '__main__':
  8.     print(prob(3, 100))
  9.     print(prob(3, 200))
  10.     print(prob(3, 300))
复制代码
回复

使用道具 举报

🔗
johnniac 2018-8-18 03:33:02 | 只看该作者
全局:
Code 2 可能是想要你写代码模拟所有结果并算出共识的结果占总结果的比例
  1. public class VotingConsensus {
  2.     int N;
  3.     int options;
  4.     int total;
  5.     int consensus;

  6.     public VotingConsensus(int n, int options) {
  7.         N = n;
  8.         this.options = options;
  9.     }

  10.     double votingConsensusProbability() {
  11.         int[] votes = new int[N];
  12.         vote(votes, 0);
  13.         System.out.println("Total: " + total + "; consensus: " + consensus);
  14.         return (Double.valueOf(consensus)/Double.valueOf(total));
  15.     }

  16.     void vote(int[] votes, int index) {
  17.         if (index == votes.length) {
  18.             for (int i: votes)
  19.              System.out.print(i+ " ");
  20.             System.out.println();
  21.             total++;
  22.             int[] result = new int[options];
  23.             for (int v: votes)
  24.                 result[v-1] ++;
  25.             for (int r: result)
  26.                 if (r >= N/2+1)
  27.                     consensus++;
  28.         } else {
  29.             for (int i=1; i<=options; i++) {
  30.                 votes[index] = i;
  31.                 vote(votes, index+1);
  32.             }
  33.         }
  34.     }
  35.     public static void main(String args[]) {
  36.         VotingConsensus votingConsensus = new VotingConsensus(4, 4);
  37.         System.out.println(votingConsensus.votingConsensusProbability());
  38.     }
  39. }
复制代码
回复

使用道具 举报

🔗
lzchu1992 2020-3-8 00:06:27 | 只看该作者
全局:
Is the system design for MLE the same as the system design for SWE?
回复

使用道具 举报

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

本版积分规则

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