【通知】7月22,工业界资深数据科学家教你破解各大公司面试!


一亩三分地论坛

 找回密码
 获取更多干活,快来注册

一亩三分地官方iOS手机应用下载
查看: 1817|回复: 1
收起左侧

Yelp 10/07 on-campus

[复制链接] |试试Instant~ |关注本帖
abcd1992719g 发表于 2016-10-8 05:08:24 | 显示全部楼层 |阅读模式

2016(10-12月) 码农类 硕士 全职@Yelp - 网上海投 - 技术电面 |Otherfresh grad应届毕业生

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

您需要 登录 才可以下载或查看,没有帐号?获取更多干活,快来注册

x
就一轮 是个亚裔姐姐. 先问了简历,然后问了网站访问比较慢 是哪些原因.
然后coding是比较简单数字转英文描述. 比如22是twenty two.
. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
聊天也聊的很开心. 她老公在MTV她在城里
. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴

求star求follow  https://github.com/gzc

qiu_cqupt 发表于 2016-10-18 08:35:12 | 显示全部楼层
关注一亩三分地公众号:
Warald_一亩三分地
这道题挺难的啊。是lc hard number to english
  1. class Solution(object):
  2.     def __init__(self):
  3.         self.less20 = ["","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"]
  4.         self.tens = ["","Ten","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"]
  5.         self.thousands = ["","Thousand","Million","Billion"]

  6.     def numberToWords(self, num):
  7.         """
  8.         :type num: int. more info on 1point3acres.com
  9.         :rtype: str
  10.         """
  11.         res = ''. 1point3acres.com/bbs
  12.         index = 0
  13.         while num:
  14.             res = self.helper(num%1000) + ' ' + self.thousands[index] + ' ' + res
  15.             index += 1
  16.             num = num//1000

  17.         return res
  18. . 1point 3acres 璁哄潧
  19.     def helper(self, num):

  20.         res = ''
  21.         if num>=100:
  22.             res = self.less20[num//100] + ' ' + 'Hundred'
  23.             num = num%100
  24.         if num >=20:
  25.             res = res + (' ' if res else '') + self.tens[num//10] + (' ' if self.tens[num//10] else '') + self.less20[num%10]
  26.         else:
  27.             res = res + (' ' if res else '') + self.less20[num]
  28.         return res

  29. num = 2111111121
  30. so = Solution()
  31. a = so.numberToWords(num). more info on 1point3acres.com
  32. print(a)
复制代码
回复 支持 反对

使用道具 举报

本版积分规则

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明

custom counter

GMT+8, 2017-7-21 02:58

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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