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

[找工就业] 2020年 微软 亚麻 脸书 Capital ONE DE类编程题

全局:

2020(4-6月)-EE硕士+5-10年 | 猎头|BayArea湾区 DataEng全职@amazon

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

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

x
本帖最后由 李浩泉 于 2020-6-27 21:03 编辑

收集了一些DE技术面试的题目,很少涉及算法,基本都是概念类基础知识,倾向用PYTHON。
Greatest Common Divisor of Strings
. Waral dи,

Input: str1 = "ABABAB", str2 = "ABAB"
Output: "AB"
. check 1point3acres for more.

  1. class Solution:   
  2.     def gcdOfStrings(self, str1: str, str2: str) -> str:
  3.         if len(str2) > len(str1):. ----
  4.             return self.gcdOfStrings(str2, str1).
  5.         if str1 == str2:
  6.             return str2
  7.         elif str1[:len(str2)] == str2:
  8.             return self.gcdOfStrings(str1[len(str2):], str2)
  9.         else:
  10.             return ""
复制代码
. Χ




评分

参与人数 14大米 +21 收起 理由
zjpjhf + 2 给你点个赞!
lcx9712 + 1 很有用的信息!
ShikiH + 2 给你点个赞!
美国运通 + 1 很有用的信息!
bbear035 + 2 给你点个赞!

查看全部评分


上一篇:求助 不加薪但级别更高 要不要跳槽?
下一篇:TikTok北美最后一轮 HR面都聊些什么
推荐
 楼主| 李浩泉 2020-7-17 02:03:33 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

推荐
 楼主| 李浩泉 2020-7-18 05:56:39 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

推荐
 楼主| 李浩泉 2020-7-17 06:40:48 | 只看该作者
本帖为密码帖 ,请输入密码 
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-27 21:10:19 | 只看该作者
全局:
PYTHON

概念:列表,字符串,字典,简单的链表和二叉树(知道怎么操作head和node,怎么取val即可)
算法:Brute Force,Recursion 和 Iteration,bar raiser有一点点会试探Divide and Conquer,比如双指针。不需要会dynamic programming和greedy。

回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-27 21:25:29 | 只看该作者
全局:
坦白说,4道PYTHON不难,难在30分钟之内全部正确解决,感觉公司已经默认所有人都是刷过3遍题的,所以不刷题或者刷题不够的,很难过的了DE面试。只有提前做过,并且非常熟练,才能在那么短的时间内把代码全部写正确。对于我而言,更喜欢90分钟做两道比较难的题,不喜欢30分钟做4道简单题。. Waral dи,

上题的Iteration做法,我就没在8分钟内解决,写出了80%的样子,早知道就用Recursion了,早知道还是要多刷题。

  1. def gcdOfStrings(self, str1, str2):. Χ
  2.         for i in reversed(range(0, len(str2))):
  3.             if len(str2) % (i + 1) or len(str1) % (i + 1):
  4.                 continue
  5.             if not str2.replace(str2[:i+1], "") and not str1.replace(str2[:i+1],""):
  6.                 return str2[:i+1]
  7.         return ""
复制代码
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-27 21:32:06 | 只看该作者
全局:
第一道题,开胃小菜,3分钟速战,不刷题也应该能做出来

把字符串的元音字母去掉

Input: "leetcodeisacommunityforcoders"
Output: "ltcdscmmntyfrcdrs"
.1point3acres
.
  1. def removeVowels(self, S: str) -> str:
  2.         s = list(S)
  3.         l = []
  4.         for c in s:. ----
  5.             if c not in ['a','e','i','o','u']:
  6.                 l.append(c)
  7.         return ''.join(l)
复制代码
. 1point3acres.com
. Waral dи,

评分

参与人数 1大米 +3 收起 理由
沽名钓誉 + 3 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-27 21:44:53 | 只看该作者
全局:
开胃小菜第二道,5分钟解决,不用刷题也应该会的

Return all strings in words which is substring of another word in any order.
Input: words = ["mass","as","hero","superhero"]
Output: ["as","hero"]

  1. def stringMatching(self, words: List[str]) -> List[str]:
  2.         l = []
  3.         for i in range(len(words)):. check 1point3acres for more.
  4.             for j in range(len(words)):
  5.                 if words[i] in words[j] and i != j:. 1point 3acres
  6.                     l.append(words[i])
  7.         return set(l)
复制代码


[/i][/i]

评分

参与人数 1大米 +3 收起 理由
沽名钓誉 + 3 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-28 01:23:53 | 只看该作者
全局:
本帖最后由 李浩泉 于 2020-6-28 01:25 编辑
. From 1point 3acres bbs
高盛的题,被capital one用了

Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length.

Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1:


Input: "IDID"
Output: [0,4,1,3,2]



  1. def diStringMatch(self, S):.1point3acres
  2.         low, high = 0, len(S)
  3.         l = []
  4.         for c in S:-baidu 1point3acres
  5.             if c == 'I':
  6.                 l.append(low)
  7.                 low += 1
  8.             else:. ----
  9.                 l.append(high)
  10.                 high -= 1
  11.         return l + [low]
复制代码

最后加上low,或者high都一样

  1. def diStringMatch(self, S: str) -> List[int]:. Waral dи,
  2.         low, high = 0, len(S)
  3.         l = []
  4.         for c in S:
  5.             if c == 'I':. 1point 3acres
  6.                 l.append(low)
  7.                 low += 1
  8.             else:
  9.                 l.append(high)
  10.                 high -= 1
  11.         return l + [high]  
复制代码



回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-29 19:13:01 | 只看该作者
全局:
  1. '''
  2. 给一个有 None 值的list,把所有None 用前一个数代替
  3. '''

  4. . check 1point3acres for more.
  5. d = [None,1,1,2, None,3,None]
  6. output = [None,1,1,2,2,3,3]

  7. s = []. 1point3acres.com
  8. c = d[0]. Χ
  9. s.append(c)
  10. for i in range(1,len(d)):
  11.     if d[i] != c and d[i] is not None:
  12.         c = d[i]
  13.         s.append(c)
  14.     else:
  15.         s.append(c)
  16. print(s)
复制代码

回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-29 19:24:16 | 只看该作者
全局:

都是基础知识

  1. '''
  2. 返回两个字符串的差值,里面含空值,排序
  3. '''

  4. s1 = 'abccdeabhf'
  5. s2 = 'ac dexbyf'
  6. output = [' ', 'h', 'x', 'y']

  7. print(sorted(list(list(set(s2).difference(set(s1))) + list(set(s1).difference(set(s2))))))
复制代码


. From 1point 3acres bbs

补充内容 (2020-9-17 23:12):
return sorted(list(set(s1).difference(s2).union(set(s2).difference(s1))))
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-29 19:27:36 | 只看该作者
全局:
  1. '''
  2. 给一个字符串,计算某个子串重复次
  3. '''
  4. .--
  5.                   
  6. s1 = 'abccdeabbf'
  7. s2 = 'ab'
  8. output = 2
  9. . Χ
  10. m = s1.count(s2)
  11. print(m)
复制代码
.1point3acres
回复

使用道具 举报

🔗
 楼主| 李浩泉 2020-6-29 19:31:06 | 只看该作者
全局:
  1. '''-baidu 1point3acres
  2. 合并overlap数值区间
  3. '''

  4. a = [[2, 3], [1, 4], [2, 10], [20, 30]]
  5. output = [[1, 10], [20, 30]]
    . check 1point3acres for more.

  6. a.sort()
  7. start = a[0][0]
  8. end = a[0][1]. ----
  9. output = []
  10. for i in range(1,len(a)):
  11.     if end >= a[i][0] and end <= a[i][1]:
  12.         end = a[i][1]
  13.     elif end < a[i][0]:
  14.         output.append([start,end]). From 1point 3acres bbs
  15.         start = a[i][0]. 1point 3 acres
  16.         end = a[i][1]
  17. output.append([start,end])
  18. print(output)
复制代码

回复

使用道具 举报

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

本版积分规则

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