推荐:数据科学课程和书籍清单以及培训讲座


一亩三分地论坛

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

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

Yelp 10/07 on-campus

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

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

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

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

x
就一轮 是个亚裔姐姐. 先问了简历,然后问了网站访问比较慢 是哪些原因. . Waral 鍗氬鏈夋洿澶氭枃绔,
然后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"]. Waral 鍗氬鏈夋洿澶氭枃绔,
  5.         self.thousands = ["","Thousand","Million","Billion"]
  6. . 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
  7.     def numberToWords(self, num):. visit 1point3acres.com for more.
  8.         """
  9.         :type num: int
  10.         :rtype: str
  11.         """
  12.         res = ''. 鍥磋鎴戜滑@1point 3 acres
  13.         index = 0
  14.         while num:. 鐣欏鐢宠璁哄潧-涓浜╀笁鍒嗗湴
  15.             res = self.helper(num%1000) + ' ' + self.thousands[index] + ' ' + res
  16.             index += 1
  17.             num = num//1000

  18.         return res
  19. . from: 1point3acres.com/bbs
  20.     def helper(self, num):

  21.         res = ''
  22.         if num>=100:
  23.             res = self.less20[num//100] + ' ' + 'Hundred'
  24.             num = num%100
  25.         if num >=20:. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
  26.             res = res + (' ' if res else '') + self.tens[num//10] + (' ' if self.tens[num//10] else '') + self.less20[num%10]
  27.         else:.鐣欏璁哄潧-涓浜-涓夊垎鍦
  28.             res = res + (' ' if res else '') + self.less20[num]
  29.         return res

  30. num = 2111111121
  31. so = Solution()
  32. a = so.numberToWords(num)
  33. print(a)
复制代码
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

custom counter

GMT+8, 2017-8-17 14:16

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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