📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 8
跳转到指定楼层
上一主题 下一主题
收起左侧

Pinterest 电面面经

全局:

2015(10-12月) 码农类General 本科 全职@pinterest - 网上海投 - 技术电面  | | Fail | 在职跳槽

注册一亩三分地论坛,查看更多干货!

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

x
又悲剧了,贡献P家电面题目,其实很简单
给你一个string array,比如{“abc”, “def
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies

结果丫说这个问题就这样吧,然后扯了10分钟淡,哎

评分

参与人数 3大米 +65 收起 理由
CorinaW + 20 注意文明用语哦
pengzewen37 + 15 感谢分享!
夏虫不知雪花 + 30

查看全部评分


上一篇:Follow up 以前Azumo 的OA 回报一下地里
下一篇:Hudson River Trading 电面面经
🔗
xiaohl0913 2015-12-11 14:16:11 | 只看该作者
全局:
有没有可能某个是string是空的""
回复

使用道具 举报

🔗
 楼主| douch 2015-12-11 14:18:46 | 只看该作者
全局:
xiaohl0913 发表于 2015-12-11 14:16
有没有可能某个是string是空的""

有可能!太谢谢了!
回复

使用道具 举报

🔗
tiger0572 2015-12-11 14:54:54 | 只看该作者
全局:
楼主这道题到底是问的什么?能再说一下吗
回复

使用道具 举报

🔗
idunknow 2015-12-11 16:33:41 | 只看该作者
本楼:
全局:
内推吗?
回复

使用道具 举报

🔗
 楼主| douch 2015-12-12 13:34:23 | 只看该作者
全局:
tiger0572 发表于 2015-12-11 14:54
楼主这道题到底是问的什么?能再说一下吗

就是把字符串数组按照说的那种格式输出出来啊
回复

使用道具 举报

🔗
ninacc 2015-12-24 13:29:49 | 只看该作者
全局:
请问楼主是海投吗还是内推啊?
回复

使用道具 举报

🔗
地里小马甲 2015-12-27 04:44:01 | 只看该作者
全局:
p家不是已经招到17年的吗。。。T T楼主是怎么投的?
回复

使用道具 举报

🔗
jeremy_sea 2016-4-19 15:48:18 | 只看该作者
全局:
大概写了一下
  1. class Solution:
  2.     # str_list: ['abc', 'def', 'hg']
  3.     # ret: 'abc, def and hg'
  4.     def get_str(self, str_lst):
  5.         if len(str_lst) == 0:
  6.             return ''
  7.         if len(str_lst) <= 2:
  8.             return ', '.join(str_lst)
  9.         last_word = str_lst[-1]
  10.         str = ', '.join(str_lst[:-1])
  11.         str = str + ' and ' + last_word
  12.         return str

  13.     def get_str_with_limit(self, str_lst, limit):
  14.         if len(str_lst) == 0:
  15.             return ''
  16.         if limit < len(str_lst):
  17.             left_part = str_lst[:limit]
  18.             return ', '.join(left_part) + ' and {0} more'.format(len(str_lst)-limit)
  19.         else:
  20.             if len(str_lst) <= 2:
  21.                 return ', '.join(str_lst)
  22.             last_word = str_lst[-1]
  23.             str = ', '.join(str_lst[:-1])
  24.             str = str + ' and ' + last_word
  25.             return str

  26. s=Solution()
  27. assert s.get_str_with_limit(['alex', 'peter', 'jeremy'], 2) == 'alex, peter and 1 more'
  28. assert s.get_str_with_limit(['alex', 'peter', 'jeremy', 'joseph'], 2) == 'alex, peter and 2 more'
  29. assert s.get_str_with_limit(['alex', 'peter', 'jeremy', 'joseph'], 3) == 'alex, peter, jeremy and 1 more'
  30. assert s.get_str_with_limit(['alex', 'peter', 'jeremy', 'joseph'], 5) == 'alex, peter, jeremy and joseph'
  31. assert s.get_str_with_limit(['alex', 'peter'], 5) == 'alex, peter'

复制代码
回复

使用道具 举报

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

本版积分规则

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