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

热烘烘的搞剩oa

🔗
 楼主| suejiangas 2018-8-6 00:24:43 | 只看该作者
全局:
LATTES 发表于 2018-8-5 09:14
请问楼主投的18还是19呢。。

19的,前两天帮朋友看了一下好像analyst不能申了,只剩19的associate了
回复

使用道具 举报

🔗
 楼主| suejiangas 2018-8-6 00:25:23 | 只看该作者
全局:
asd101200 发表于 2018-8-2 09:32
感谢lz分享,可以麻烦你再详细说一下第一题吗? 我的思路是遍历一下list中的所有string,找出每列中最长的 ...

我思路跟你基本上一样~输出是一个string
回复

使用道具 举报

🔗
294413979 2018-11-29 01:50:18 | 只看该作者
全局:
楼主楼主!csv那道题我这样写对吗?
input : {"country,type,vendor1,vendor2,vendor3,vendor4",
        "india,1,13.5,14,15,14.5"}
  1. string csvFormmatter(vector<string> lines){
  2.     vector<int> wordLength;
  3.     string res = "";
  4.     for(string s : lines){
  5.         string word;
  6.         stringstream ss(s);
  7.         int wcount = 0;
  8.         while(getline(ss, word, ',')){
  9.             if(wcount >= wordLength.size()){
  10.                 wordLength.push_back((int)word.length());
  11.             } else {
  12.                 wordLength[wcount] = max(wordLength[wcount], (int)word.length());
  13.             }
  14.             wcount++;
  15.         }
  16.     }
  17.     for(string s : lines){
  18.         string word;
  19.         stringstream ss(s);
  20.         int wcount = 0;
  21.         while (getline(ss, word, ',')) {
  22.             res += wcount > 0 ? " " : "\n";
  23.             int ldis = wordLength[wcount] - word.length();
  24.             while(ldis-- > 0){
  25.                 word  = " " + word;
  26.             }
  27.             res += word;
  28.             wcount++;
  29.         }
  30.     }
  31.     return res.substr(1);
  32. }
复制代码
回复

使用道具 举报

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

本版积分规则

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