一亩三分地论坛

 找回密码
 获取更多干货,去instant注册!

扫码关注一亩三分地公众号
查看: 631|回复: 1
收起左侧

Yelp 10/07 on-campus

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

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

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

您需要 登录 才可以下载或查看,没有帐号?获取更多干货,去instant注册!

x
就一轮 是个亚裔姐姐. 先问了简历,然后问了网站访问比较慢 是哪些原因. . 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
然后coding是比较简单数字转英文描述. 比如22是twenty two.. 1point 3acres 璁哄潧

聊天也聊的很开心. 她老公在MTV她在城里 . 1point3acres.com/bbs
鏉ユ簮涓浜.涓夊垎鍦拌鍧.
. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
求star求follow  https://github.com/gzc. From 1point 3acres bbs
. from: 1point3acres.com/bbs
qiu_cqupt 发表于 2016-10-18 08:35:12 | 显示全部楼层
这道题挺难的啊。是lc hard number to english-google 1point3acres
  1. class Solution(object):. Waral 鍗氬鏈夋洿澶氭枃绔,
  2.     def __init__(self):-google 1point3acres
  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.         """. 1point 3acres 璁哄潧
  8.         :type num: int
  9.         :rtype: str
  10.         """
  11.         res = ''
  12.         index = 0
  13.         while num:
  14.             res = self.helper(num%1000) + ' ' + self.thousands[index] + ' ' + res
  15.             index += 1. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
  16.             num = num//1000.鏈枃鍘熷垱鑷1point3acres璁哄潧
  17. -google 1point3acres
  18.         return res

  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].1point3acres缃
  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). visit 1point3acres.com for more.
  32. print(a)
复制代码
回复 支持 反对

使用道具 举报

本版积分规则

请点这里访问我们的新网站:一亩三分地Instant.

Instant搜索更强大,不扣积分,内容组织的更好更整洁!目前仍在beta版本,努力完善中!反馈请点这里

关闭

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

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2017-1-20 18:20

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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