查看: 1732| 回复: 4
跳转到指定楼层
上一主题 下一主题
收起左侧

[找工就业] 一个小公司的非寻常take home project, 真心求帮助, 回复的都加米!!!

🔗
匿名用户-3VMXB  2019-10-13 15:51:54 |倒序浏览

2020(4-6月)-CS本科+fresh grad 无实习或全职 | 网上海投|BayArea湾区 码农类General全职@

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

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
本菜鸡最近投了一家才成立了几个月的公司(小到都google不到那种), 给发了一个take home project, 找了好几个月工作了因为太菜也没有几个面试机会, 所以想认认真真的把这个做了... 奈何能力还是太浅, 真心求各位大佬给建议:
给了一段python code:  包含一个全局叫document和一个hashset叫dictionary, define了几个基础function: copy(i), paste(i,j), cut(i,j), misspellings(). i,j指的是要copy/paste到document的位置. 逻辑很直白, 问的是如何优化performance. 主要code贴在下面了. 目前能想到的优化就是1. copy的时候只记录i和j而不是存一整段copied的内容. 2. (maybe)Document的内容用doubly linkedlist存来加快delete/insert的速度. 用一个hashmap存index和对应的node. 题目要求说是一个开放性问题, 希望大佬们能给点提示!!

给的主要code:.google  и
class SimpleEditor:
    def __init__(self, document):
        self.document = document
        self.dictionary = set()
        with open("...\words") as input_dictionary:
            for line in input_dictionary:. From 1point 3acres bbs
                words = line.strip().split(" ")
                for word in words:
                    self.dictionary.add(word)
        self.paste_text = ""

    def cut(self, i, j):
        self.paste_text = self.document[i:j]
        self.document = self.document[:i] + self.document[j:]

    def copy(self, i, j):
        self.paste_text = self.document[i:j]. Χ
. 1point 3acres
    def paste(self, i):
        self.document = self.document[:i] + self.paste_text + self.document[i:]
.google  и
   def misspellings(self): #check number of misspellings in the document
        result = 0
        for word in self.document.split(" "):
            if word not in self.dictionary:
                result = result + 1
        return result

. ----

评分

参与人数 1大米 +1 收起 理由
K叔 + 1 赞一个

查看全部评分


上一篇:收到了fb和苹果intern offer,选哪个?
下一篇:Blackrock Virtual Cover Letter 最新
🔗
Jdycgs 2019-10-13 21:13:42 来自APP | 只看该作者
全局:
感觉是leetcode上一道题目类似诶...不知道是不是的
回复

使用道具 举报

🔗
frefre 2019-10-13 22:23:00 来自APP | 只看该作者
全局:
Jdycgs 发表于 2019/10/13 21:13:42.
感觉是leetcode上一道题目类似诶...不知道是不是的
可以说一下题号或者名字嘛
回复

使用道具 举报

🔗
Jdycgs 2019-10-14 09:46:58 来自APP | 只看该作者
全局:
frefre 发表于 2019/10/13 22:23:00
可以说一下题号或者名字嘛
不太记得了就是 sorry啊
回复

使用道具 举报

🔗
frefre 2019-10-16 04:09:47 | 只看该作者
全局:
顶顶顶 zszszszszs
回复

使用道具 举报

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

本版积分规则

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