# RobinHood 最新OA

70 min , 4道题，全程监控屏幕并开摄像头录像，所以没法截图

1. find distinct triplet: given a string, find all triplets that contain distinctive Characters, return the number of total triplets
2. add 2 numbers, digit by digit, starting from right end. For instance, String a = “11”, String b = “9”, return “110”
3. rotate matrix, while fixing the diagonal and anti-diagonal element. another input argument is a number, `1` stand for rotating 90 degrees clockwise, `2` for 180, `3` for 270.
example: input m = [ 1 2 3; 4 5 6; 7 8 9], n = 1, result = [1 4 3; 8 5 2; 7 6 9]
4. cut the ribbon, given an array of ribbon length (let’s say m), and an integer n, return the maximal length l that we can cut the ribbon and make at least n ribbons of the same length l

2 Likes

[ 1, 2, 3, 4],
[ 5, 6, 7, 8],
[ 9,10,11,12],
[13,14,15,16]
rotate 90 degree以后，5是和2换还是和3换··

1. triplet含有3个character相同但不同顺序算吗 比如abc，bac算同一种情况吗
2. triplet一定是这个string的substring吗？还是说只要是这个string含有的character组成就可以，例如string为abcd，triplet可以是abd吗？
求回复 0 0

abc, bac 算不同情况；triplet必须是substring

1 Like

``````def find_distinct_triplet(s):

distinct_triplets = set()

for i in range(0, len(s)-2):
if s[i:i+3] not in distinct_triplets:

return len(distinct_triplets)

print(find_distinct_triplet("abcabcabcccc"))

``````

triplet只需要包含不同Character就行，triplet本身不需要distinctive

1 Like

robinhood爽