注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
也是搬运汇总的,5月份拿到的full time offer,题目有的比较久远了,有选择的看吧!
1.
2.
3. Leetcode 56
4. 立扣 387
给你一个string consisting of lowercase English letter only, return the index of first non- repeating character in it. If it does not exist, return -1.
Example: s = "abccccc". Output: 0
1. Find Lowest Price
2. N门考试,每科要A题做对才过,每科已经做对B题,问如果再做对K题,最多能通过多少考试
3. 给你一个String consisting of lowercase English letter only, return the index of first non-repeating character in it. If it does not exist, return -1.
Example: S = “abccccc”. Output: 0
4. 立扣 妖肆玖二pth Factor of n
Given n and p, consider a list of all factors of n sorted in ascending order, return pth factor in this list or return -1 if n has less than k factors.
Example:n = 7, p = 2
Output: 7
Explanation: Factor list is [1,7], the 2nd factor is 7.
5. Leetcode 387 56 696
6.
7.
8.
9. count Maximum Teams
10. valid String
11. find Password Strength
dp: number of distinct letters for all substring end at i
lastIndex: last index for each letter before position i
dp = dp[i - 1] + i - lastIndex[password]
相关链接:
string密码强度表示为sum of distinct characters of all its substrings
样例:
"good" = 16 (g, o, o, d, go, oo, od, goo, ood, good)
long findPasswordStrength(string password) {}
12. 例如 give array [1,2,3] 所有sub array 最大值最小值相加的求解
[1] max 1 min 1 max - min = 0
[2] max 2 min 2 max - min = 0
[3] max 3 min 3 max - min = 0
[1,2] max 2 min 1 max - min = 1
[2,3] max 3 min 2 max - min = 1
[1,2,3] max 3 min 1 max - min = 2
把所有差加起來是 0 + 0 + 0 + 1 + 1 + 2 = 6
13. 第一題: linked list 利口題 忘了哪題 第一個element + 最後element
第二個element + 倒數第二element
...
比較大小return 最大的,解法把後半LL reverse
14. Leetcode 2104
15. 字符串里包含(,),【,】和?,求有几种分割方式能使两个子字符串都是balanced string, balanced string 是指两种括号的开和关数量相等,问号可以充当任意括号
16. Given max. travel distance and forward and backward route list, return pair of ids of forward and backward routes that optimally utilized the max travel distance.
eg: max travel distance is : 11000
forward route list : [1,3000],[2,5000],[3,4000],[4,10000]
backward route list : [1,2000],[2,3000],[3,4000]
17. 雨淋音乐,给了list: 歌曲长度和int 路程时间。需要找2首歌加起来= 路程时间-30mins。简单的两数之和。
list不是有序的
同一首歌不能重复选
存在所有歌都是一样长度
如果多种方案要选包括最长单曲的;以及如果多首歌相同长度,要选index最小的
18. BFS雨淋生鲜配送,计算最短路径。
19. sya certain building location can only provide Internet
to the buildings in the range (i - routerRange, i+ routerRange). A building is considered to be served if the number of routers providing Internet to the building is greater than or equal to the number of people living in it. Given a list of the number of people living in each building, the locations of the buildings where the routers will be installed and each router's range, find the number of served buildings in the city.
Example
buildingCount = [1, 2, 1, 2, 2]
routerLocation = [3, 1]
routerRange = [1, 2]
There are 5 buildings with tenant counts shown in buildingCount. Routers are located in buildings 3 and 1 with ranges 1 and 2 as shown in routerLocation and routerRange.
The number of routers providing Internet to building 1 is 1, which is equal to the number of people living here, so building 1 is served.
The number of routers providing Internet to building 2 is 2, which is equal to the number of people living here, so building 2 is served.
The number of routers providing Internet to building 3 is 2, which is greater than the number of people living here, so building 3 is served.
Building 4 only has coverage from 1 router, which is less than the number of people living there. The building is unserved.
Building 5 has no router coverage, so building 5 is unserved.
The 3 served buildings are 1, 2, and 3. Return 3.
23.
24.
25.
26. |