注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
求加米!!!
求加米!!!
求加米!!!
很注重C Programming
没有OA 咩有店面 直接5轮onsite
coding1 hexDump- /*
- 1. Give a buffer pointer "buf" and the length of the buffer "len", print the buffer such that each line starts with the offset and then 16 bytes.
- void hexdump(void *buf, len)
- output:
- 000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
- 000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
- */
- #include <stdio.h>
- int main() {
- return 0;
- }
- void hexDump(unsigned char buf[], int len) {
- int countLine = 0;
- for (int i = 0; i < len; i++) {
- if (i %16 == 0) {
- printf("%07x", countLine * 16);
- countLine ++;
- }
- printf("%02x", buf[i]);
- if ((i + 1) % 16) {
- printf("\n");
- } else {
- printf(" ");
- }
- }
- }
复制代码 coding2 oneFromMSB (我真的不会写 下面的代码是错的)- /*
- find "1" from MSB side.
- Example:
- x = 101100001
- ^^^^^^^^^
- |||||||||
- 876543210 right to left
- *
- return 8
- x = 110100
- ^^^^^^
- ||||||
- 543210 right to left
- *
- return 5
- x = 0101
- ^^^^
- ||||
- 3210 right to left
- *
- return 3
- */
- #include <math.h>
- #include <stdio.h>
- unsigned binaryToDecimal(unsigned n)
- {
- int num = n;
- int dec_value = 0;
- int base = 1;
- int temp = num;
- while (temp) {
- int last_digit = temp % 10;
- temp = temp / 10;
- dec_value += last_digit * base;
- base = base * 2;
- }
- return dec_value;
- }
- int msb(unsigned x) {
- unsigned decimal = binaryToDecimal(x);
- int position = 1;
- int leftMost = -1;
- // Iterate while number > 0
- while(decimal > 0)
- {
- // Check if last bit is 1
- if(decimal & 1){
- leftMost = position - 1;
- }
- // Increment position counter and right shift number
- position++;
- decimal = decimal>>1;
- }
- return leftMost;
- }
-
- // Driver code
- int main()
- {
- unsigned a = 101100001;
- printf("expected 8, actual %u\n", msb(a));
- unsigned b = 110100;
- printf("expected 5, actual %u\n", msb(b));
- unsigned c = 1101;
- printf("expected 3, actual %u\n", msb(c));
- return 0;
- }
复制代码 Hiring manager说 我们是天天写system level C code, we are dinosaurs, nothing interesting compared with Internet companies。 我服了
System Design 聊design simple FireWall - 原理就是利用TCP 3 way handshake,在server 和client中间加firewall, firewall keep track of SYN-ACK from client.
Prep Notes很多是来自地里 谢谢前辈们
Network packet
UDP
TCP Concept
Firewall Concept
A firewall determines what packets should be accepted, denied, or dropped based on its policy.
Physical firewall - PANOS - APPID
Virtual Firewall - Prisma Cloud
DDoS Attack
Resource used to process and ACK - resource heavy
Implement a Firewall
Header
Src
Dst
Seq
Data
1223849128376128734129834712985712
3412341234213412342134123412341234
1341234123412342141234213421341234
1223849128376128734129834712985712
3412341234213412342134123412341234
1341234123412342141234213421341234
1223849128376128734129834712985712
3412341234213412342134123412341234
1341234123412342141234213421341234
1223849128376128734129834712985712
3412341234213412342134123412341234
1341234123412342141234213421341234
Best Effort
TCP 3 way handshake
Sender -> SYN -> Receiver
<- ACK <-
-> SYN_ACK ->
FireWall: keep track of SYN-ACK,
PaaS
Manageability
Visibility
SD-WAN - Software-Defined Networking
TCP / UDP, 什么时候用哪个,还问到设计一个app时网络拥堵怎么办,
TCP和UDP的区别。如果要对服务器发起DoS攻Rit at the same time. Because the thread scheduling algorithm can swap between threads at any time, you don't know the order in which the threads will attempt to access the shared data. Therefore, the result of the change in data is dependent on the thread scheduling algorithm, i.e. both threads are "racing" to access/change the data.
Problems often occur when one thread does a "check-then-act" (e.g. "check" if the value is X, then "act" to do something that depends on the value being X) and another thread does something to the value in between the "check" and the "act". E.g:
system design
例如其中问道了一些在单机情况下如何去sort一个庞大到塞不下FS里的大文件,思路是怎么样的。
OOD:
minHeap的实现
Project
因为我主要写java和c++,问了两个语言的差别。
HTTP application
WebSocket application
TCP/UDP transport layer
IP network layer
Ethernet data link layer
Wi-Fi data link
ICMP network layer
Distributed Key Value Store Project:
|