Uncategorized

Result

Okay, I failed. I’ve worked as a software engineer for about 10 years and never tried to take new roles so far, and after all I was not ready to pass tech interviews.

I’d studied for 3 months since last December and stopped. And I resumed last June and I’ve applied for many openings while preparing tech interviews for last two months, but I haven’t got any offers. (Actually I got only one “pass” from a startup but unfortunately an inside transfer took my chance.)

Here’s my “major” apply list. Actual list is longer than that. Fortunately it was easy to pass HR screening due to my experience:
Samsung
Facebook
Amazon
Apple
Uber
AMD
Intel
Nvidia
Google

I feel like my problem solve skill is improving as I’m interviewing more, but it’s too late. My chances were running out.

Anyway, I failed. Few companies gave me a brief feedback. Based on it and my feelings, the major reasons for the failure are
* I failed to express my thought process clearly.
* My thought process was not as quick as other candidates’.

As a non native speaker (as you’ve already known), I admit I have a communication issue. And my technical preparation was not enough.

So, I have to practice more, study more, solve problems more, and I will do.
I’ll give it a try one year later(Google doesn’t allow to apply twice in a year)

I took this advice from https://news.ycombinator.com/item?id=7930098

Preparation really is the key. There may be folks out there that can ace technical interviews at Google or Facebook on any random day without preparation but in my experience, and I know many smart engineers, those people are by far the exception not the rule. As the below comment says, just like the SAT, prepare. Really.

Question

Queue with two stacks

Implement queue with two stacks

Image uploaded from iOS (7).jpg


template<class T> 
class StackNode {
public:
    StackNode(T initVal) {
        value = initVal;
        next = NULL;
    }

    T value;
    StackNode* next;
};

template<class T>
class Stack {
public:
    Stack() { top = NULL; }
    ~Stack() {
        StackNode<T> *node = top;
        while (node) {
            StackNode<T> *next = node->next;
            delete node;
            node = next;
        }

    }
    bool isEmpty() { return (top == NULL); }
    void push(T value) {
        StackNode<T> *node = new StackNode<T>(value);
        
        if (top) {
            node->next = top;
        }
        top = node;
    }
    T pop() {
        assert(top);
        
        T val = top->value;
        StackNode<T> *next = top->next;
        delete top;
        top = next;
        return val;
    }
    StackNode<T> *top;
};

template<class T>
class Queue {
public:
    Queue() {}
    ~Queue() {}

    void add(T value) {
        inStack.push(value);
    }

    T remove() {
        if (outStack.isEmpty()) {
            while (!inStack.isEmpty()) {
                outStack.push(inStack.pop());
            }
        }
        return outStack.pop();
        
    }

    Stack<T> inStack;
    Stack<T> outStack;
};

Question

Rotate matrix

Rotate N x N matrix in 90 degrees, in place.

Image uploaded from iOS (3).jpg


 void rotate90(int** Mat, int N) {
    bool* visited = new bool[N*N];
    memset(visited, 0, sizeof(bool) * N * N);
    for (int row = 0; row < N; row++) {
        for (int col = 0; col < N; col++) {
            //Mat[row][col]         -> Mat[col][N-1-row]
            //Mat[col][N-1-row]     -> Mat[N-1-row][N-1-col]
            //Mat[N-1-row][N-1-col] -> Mat[N-1-col][row]
            //Mat[N-1-col][row]     -> Mat[row][col]
            if (visited[row*N + col]) continue;

            int temp = Mat[row][col];
            Mat[row][col] = Mat[N - 1 - col][row];
            Mat[N - 1 - col][row] = Mat[N - 1 - row][N - 1 - col];
            Mat[N - 1 - row][N - 1 - col] = Mat[col][N - 1 - row];
            Mat[col][N - 1 - row] = temp;
            visited[row*N + col] = true;
            visited[(N - 1 - col)*N +row] = true;
            visited[(N - 1 - row)*N + N - 1 - col] = true;
            visited[(col)*N + N - 1 - row] = true;
        }
    }
}