r****8 发帖数: 22 | 1 networking背景。和web公司的风格不大一样。多个公司的面筋。希望对后来人,有帮
助。
implement a hash table
lru cache
two sum
void store(int val);
store the value
bool test(int target);
return true if two stored values who sum equals target
otherwise false
We want test really fast.
O(1) test
O(n) store
Given a binary tree where parent node value is minimum of two children node
values, find the second min.
given nested list, return sum. Sum is defined as depth*current sum
what is dead lock? how to prevent it?
implement a readlock
implement a read write lock
how to create a c++ class preventing child from inheriting it?
reverse a stack without using extra memory
given a array, find the maximum continuous subarray sum
given a list of list
[1,[2,3],[4,5,[5,6]],0]
there could be multiple nesting
implement a next() api to find the next element.
given a file of words and a word
find all anagrams of the given word in the file
what is singleton
design the twitter backend. there are many tweets within the past 24 hours,
how to find the top 5.
Do you use java? Do you know java swing?
Design a timer lib.
printf(“%s”,NULL);
not crash
printf(“%sn”,NULL);
crash
why?
class C {
public:
void func() { printf(“non-virtual functionn”);}
virtual void vfunc() { printf(“virtual functionn”); }
};
C *obj=NULL;
obj->func(); ⇒ this does not crash. C::
obj->vfunc(); ⇒ this crashes, two memory accesses.
why?
difference between virtual function and non-virtual function
int get() {
static int d=1;
return d++;
}
printf(“%d %d %d”,get(),get(),get());
output?
Little endianness and big endianness
Byte padding in struct
Memory layout of argc, argv of main function
printf is a variable number of arguments function
gdb –g option,
How to design an general interface with different function implementations
using c?
Similar to base class and derived class.
Use function pointer to implement it. | r****8 发帖数: 22 | 2 heck if a tree has a cycle
duplicate a graph
char *p;
p=*p=0;
what’s wrong with this code?
char *p;
p=*p=0;
what’s wrong with this code?
using uninitialized pointer
who will generate segmentation fault?
hardware, CPU.
how is segmentation fault generated?
CPU generates an unrecoverable fault, a kind of exception
why the lower address space is not used by neither os nor process?
avoid damage caused by uninitialized pointer
uninitialized pointer often contains garbage value which is small. That is
it points to lower address space. When we use it, it will not cause big
damage, since the lower address space is not used by anyone.
what is page size?
4KB
how to include header file using gcc
use –I directory
level print bt
from bottom to top
rotate matrix by 90 degree
given a large file containing strings, find the most frequent string
write code to determine endianness
what is big/little endianness
given two sorted arrays, find the intersect elements, and call a function
with input as the intersect element
what if one of the array is large and fixed?
2,3,4,5,6,7,8
store continuous number segment in balanced BST
print nth fib number
given a set of points on the line segment, and distance between two points,
find the minimum distance between two points x and y
o…………o…………………0………………0…………………o………………….o
dp problem
find the min and max of the array with less comparison, three instead of
four every two numbers
difference between process and thread
find the largest and second largest numbers
remove a character from the an input string
remove duplicate characters from an input string
check if a string has duplicate characters
byte alignment
struct my_struct{
double d1;
int d4;
char c[3];
int d2;
char h[0];
};
reverse a string
how is hashtable implemented
what is heap
what is stack (data structure)
what is stack (memory)
interprocess communication methods?
pipe, message queue, file, socket, shared memory, signal,
what is the software development flow? | y**********u 发帖数: 6366 | 3 赞!
node
,
【在 r****8 的大作中提到】 : networking背景。和web公司的风格不大一样。多个公司的面筋。希望对后来人,有帮 : 助。 : implement a hash table : lru cache : two sum : void store(int val); : store the value : bool test(int target); : return true if two stored values who sum equals target : otherwise false
|
|