楼主: bobzhang2004
跳转到指定楼层
上一主题 下一主题
收起左侧

google 电话本问题讨论

🔗
liuyifly06 2016-3-8 03:23:42 | 只看该作者
全局:
googlerr 发表于 2016-3-8 02:32
"The second HashMap record unregistered numbers."

如何record unregistered numbers?

What I was saying is that initialize second Hash Map (unregistered numbers) with 000-000-0000 to 999-999-9999. Whenever you add a number to the first Hash Map(registered numbers), delete the corresponding key in the second Hash Map.

Without second Hashmap, I just have no idea how you can find an unregistered number in O(1).
回复

使用道具 举报

🔗
googlerr 2016-3-8 05:26:24 | 只看该作者
全局:
liuyifly06 发表于 2016-3-8 03:23
What I was saying is that initialize second Hash Map (unregistered numbers) with 000-000-0000 to 9 ...

这样的话,内存会不会太大了?
回复

使用道具 举报

🔗
liuyifly06 2016-3-8 06:10:50 | 只看该作者
全局:
googlerr 发表于 2016-3-8 05:26
这样的话,内存会不会太大了?

yes~ indeed. A lot of memory ...
回复

使用道具 举报

🔗
say543 2016-3-8 15:50:31 | 只看该作者
全局:
Inspired by two-hashMap solution,  maybe two-tries solution  is possible since it can reduce memory usage?
Even using  tries,  i think you can still randomly generate a new available phone number
with tries, you can know how many available digits for one number
Repeating the same procedure then you you get a phone number.



回复

使用道具 举报

🔗
say543 2016-3-8 15:50:47 | 只看该作者
全局:
liuyifly06 发表于 2016-3-8 06:10
yes~ indeed. A lot of memory ...

Inspired by two-hashMap solution,  maybe two-tries solution  is possible since it can reduce memory usage?
Even using  tries,  i think you can still randomly generate a new available phone number
with tries, you can know how many available digits for one number
Repeating the same procedure then you you get a phone number.
回复

使用道具 举报

🔗
 楼主| bobzhang2004 2016-3-8 23:11:41 | 只看该作者
全局:
题目没有说要randomly 产生电话表,trie可以省内存,返回时任意返回一个即可
回复

使用道具 举报

🔗
googlerr 2016-3-9 00:21:49 | 只看该作者
全局:
bobzhang2004 发表于 2016-3-8 23:11
题目没有说要randomly 产生电话表,trie可以省内存,返回时任意返回一个即可

getAvailable就相当于产生一个random的电话号码吧
回复

使用道具 举报

🔗
 楼主| bobzhang2004 2016-3-9 02:57:34 | 只看该作者
全局:
googlerr 发表于 2016-3-9 00:21
getAvailable就相当于产生一个random的电话号码吧

请问这个google刷题小组是微信号还是QQ号啊
回复

使用道具 举报

🔗
huai10 2016-3-9 03:33:24 | 只看该作者
本楼:
全局:
bitmap?
回复

使用道具 举报

🔗
googlerr 2016-3-9 04:59:31 | 只看该作者
全局:
bobzhang2004 发表于 2016-3-9 02:57
请问这个google刷题小组是微信号还是QQ号啊

QQ群号~~~
回复

使用道具 举报

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

本版积分规则

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