面试题
文章平均质量分 63
Albahaca
这个作者很懒,什么都没留下…
展开
-
Secret decoder
Your task is to decode messages that were encoded with substitution ciphers. In a substitution cipher, all occurrences of a character are replaced by a different character. For example, in a cipher th原创 2014-02-06 14:33:39 · 757 阅读 · 0 评论 -
aligned memory allocation
void *aligned_alloc(size_t size, size_t align) { void *p = NULL; void *ret = NULL; p = malloc(size + align + sizeof(void *)); if (!p) return NULL; size_t offset = align - (size_t)p % alig原创 2016-03-22 23:23:56 · 530 阅读 · 0 评论 -
Convert a Ternary expression to a Binary tree structure
#include #include #include using namespace std;struct TreeNode { char val; TreeNode *left; TreeNode *right; TreeNode(char c): val(c), left(NULL), right(NULL) {}};// To execute C++, ple原创 2015-06-24 08:08:38 · 655 阅读 · 0 评论 -
5.27 1h
Hi1. What does 2>&1 mean and when is it typically used when added to end of a unix command line ?&1# ls -l /mydir >/tmp/out 2>&12. Write a shell script which will take a command-line par原创 2014-05-28 11:40:42 · 500 阅读 · 0 评论 -
5.28 1h
void HandleCall(Call &call)class Employee {Handler h;public:bool free;void ReceiveCall (Call &call); // doesn’t return until the call is finishedvoid CanHandleCall (Call &call);原创 2014-05-29 06:06:57 · 744 阅读 · 0 评论 -
Implement a queue/stack
Queue:Doubly linked list:#include using namespace std;struct ListNode { int val; ListNode *next, *pre; ListNode(int x) :val(x), next(NULL), pre(NULL) {}};class Queue { private: Lis原创 2014-03-28 02:38:07 · 406 阅读 · 0 评论 -
2/7/14, 40min
OS:1: The difference between process and thread? Can multiple threads/processes share memory? How does synchronization between threads work?2: Where are local variables stored in memory? Ans: Stac原创 2014-02-08 04:50:02 · 441 阅读 · 0 评论 -
Zenefits 第一轮编程题
两道题都是所有test cases都过了,直接贴代码了/* * #1 Flip bit */int bitFlip(int arr_size, int* arr) { int no_flip = 0; int flip = 0, flip_min = 0; int i = 0; int *transform = NULL; // Vali原创 2016-02-29 03:14:17 · 428 阅读 · 0 评论