字节跳动面试(一面)数据平台校招-后端开发工程师
秋招末,一个offer没有,惨!已经没多少信心了。
还好面试官温和,感觉心情好了点。
问了:
1.C++11新特性有哪些;
如,右值引用在哪里实现
2.进程、线程区别;
一个多线程,如何保证对一个变量的修改读取,不会出现脏读。
3 操作系统,linux?(没弄过linux😂,不太会)
很多忘了~
编程问题:
1 实现36进制的加法。0-9-a-z(36个)
如: 1+9 = a
1 + "zz" = 100
搞了很久:
#coding=utf-8 import sys #str = input() #print(str) print('Hello,World!') def out(s): if "a"<=s<="z": return (ord(s)-ord("a"))+10 print(int(s),s) return int(s) def get(n): if 0<=n<=9: return str(n) a = ord("a") t = n-10+a s = chr(t) print(a,t,s) return s def add(st1,st2): L1 = len(st1) L2 = len(st2) res = [] s = 0 while L1>0 and L2>0: L1 -= 1 L2 -= 1 s1 = st1[L1] s2 = st2[L2] temp = out(s1)+out(s2)+s print(temp) s = 0 if temp>=36: temp -= 36 s = 1 res.append(get(temp)) while L1>0: L1 -= 1 temp += out(s1)+s s = 0 if temp>=36: temp -= 36 s = 1 res.append(get(temp)) while L2>0: L2 -= 1 temp += out(s2)+s s = 0 if temp>=36: temp -= 36 s = 1 res.append(get(temp)) if s==1: res.append(get(s)) res = res[::-1] return "".join(res) st1 = "1" st2 = "zz" print(add(st1,st2))2. 时间原因,只说思路(结束时45分钟了😂):
m个有序数组,求第n 小:
如: 1 3 5 7 9
2 4 6 8 10
第5小的,就是5