一亩三分地论坛

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

扫码关注一亩三分地公众号
查看: 504|回复: 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.

聊天也聊的很开心. 她老公在MTV她在城里


求star求follow  https://github.com/gzc. more info on 1point3acres.com

qiu_cqupt 发表于 2016-10-18 08:35:12 | 显示全部楼层
这道题挺难的啊。是lc hard number to english
  1. class Solution(object):. more info on 1point3acres.com
  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
  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.         return res
  18. -google 1point3acres
  19.     def helper(self, num):

  20.         res = ''
  21.         if num>=100:
  22.             res = self.less20[num//100] + ' ' + 'Hundred'
    .1point3acres缃
  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. . 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
  30. num = 2111111121
  31. so = Solution()
  32. a = so.numberToWords(num) 鏉ユ簮涓浜.涓夊垎鍦拌鍧.
  33. print(a)
复制代码
回复 支持 反对

使用道具 举报

本版积分规则

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

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

关闭

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

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

custom counter

GMT+8, 2016-12-5 01:30

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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