选择题难度还行吧,随缘。
两个算法题: 0.55 1
第一个暴力超时,不想动脑筋了,是信息安全数学基础的数学概念,概念几乎忘完了。。。
最重要的是编程题,一脸懵,感觉跟手写promise有一拼。直接放弃了。。。。
对面试不抱啥希望
贴个代码吧(python):
第一题(超时 55%)
t = int(input()) for _ in range(t): n = int(input()) cnt = 0 if n == 2 or n == 3: print(1) continue for i in range(2, n): t = True for j in range(1, n-2): if i ** j % n == 1: t = False break if t and i ** (n-1) % n == 1: cnt += 1 print(cnt)
第二题:100%
n = int(input()) aList = [int(i) for i in input().split()] aList.sort(reverse=True) temp = 0 obj = {} for i in aList: if i in obj: obj[i] += 1 else: obj[i] = 1 result = [aList[0]] t = True for i in obj: if i == aList[0]: continue if obj[i] % 2 == 0: result.insert(0, i) result.append(i) t = True else: if t: result.insert(0, i) t = False else: result.append(i) t = True for i in range(len(result) - 1): temp = max(temp, abs(result[i+1]- result[i])) temp = max(temp, abs(result[0] - result[-1])) print(temp)#我的求职思考#