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

司踹普NG OA新鲜出炉,含图!求加米

🔗
匿名用户-OCQTV  2021-10-13 00:15:12 |倒序浏览

2021(10-12月) 码农类General 硕士 全职@stripe - 网上海投 - 在线笔试  | 😐 Neutral 😐 Average | Other | 应届毕业生
本帖最后由
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies

求各位客官加米!!感谢!

本帖子中包含更多资源

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

x

评分

参与人数 3大米 +12 收起 理由
地里的生活菌 + 10 给你点个赞!
大眼狗 + 1 给你点个赞!
3wen + 1 很有用的信息!

查看全部评分


上一篇:databricks 第一轮和第二轮,solution Architect
下一篇:LUMEN 第一轮HIREVIUE
地里匿名用户
🔗
匿名用户-IEWML  2021-10-16 02:50:51
Share a solution let's crack Stripe
  1. public class BetaInvites {
  2.   Set<String> bolts = new HashSet<>();
  3.   Map<String, Long> ave;
  4.   // User:  <Date without second, req counts>
  5.   Map<String, Map<Date, Integer>> detect = new HashMap<>();
  6.   Map<String, Long[]> status = new HashMap<>();

  7.   public void process_invites(int N, String csvfilepath) throws IOException {
  8.     try (BufferedReader fb = Files.newBufferedReader(Paths.get(csvfilepath))) {
  9.       String line;
  10.       while ((line = fb.readLine()) != null && N-- > 0) {
  11.         parseLog(line);
  12.       }
  13.       System.out.println(handle());
  14.     } catch (ParseException e) {
  15.       e.printStackTrace();
  16.     }
  17.   }

  18.   private void parseLog(String log) throws ParseException {
  19.     String[] l = log.split(",");
  20.     long t = Long.valueOf(l[0]);
  21.     String eventType = l[1], userId = l[2];

  22.     if (bolts.contains(userId)) return;
  23.     status.putIfAbsent(userId, new Long[] {null, null, null});

  24.     if (eventType == "invite_requested") {
  25.       Date d = new Date(t);
  26.       d.setSeconds(0);
  27.       if (!detect.containsKey(userId)) {
  28.         detect.put(userId, new HashMap<>());
  29.         detect.get(userId).put(d, 1);
  30.       } else {
  31.         Map<Date, Integer> count = detect.get(userId);
  32.         count.put(d, count.getOrDefault(d, 0) + 1);
  33.         if (count.get(d) >= 5) bolts.add(userId);
  34.       }

  35.       if (status.get(userId)[0] != null) status.get(userId)[0] = t;
  36.     } else if (eventType == "invite_send") {
  37.       status.get(userId)[1] = t;
  38.     } else if (eventType == "invite_activated") {
  39.       Long a = status.get(userId)[0], b = status.get(userId)[1];
  40.       if (a != null && b != null && a < b && b < t) ave.put(userId, t - a);
  41.     }
  42.   }

  43.   public String handle() throws ParseException {
  44.     Long sum = 0l, count = 0l;
  45.     for (Map.Entry<String, Long> e : ave.entrySet()) {
  46.       if (bolts.contains(e.getKey())) continue;
  47.       sum += e.getValue();
  48.       count++;
  49.     }
  50.     return bolts.size() + " " + sum / count;
  51.   }
  52. }
复制代码
求米求米

评分

参与人数 1大米 +3 收起 理由
地里的生活菌 + 3 给你点个赞!

查看全部评分

回复

使用道具 举报

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

本版积分规则

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