# Personal growth vs team vs others

Once upon a time, I was asked, if you have to pick only one, “personal growth, team, something else I forgot”, which one would you pick? The correct answer is “it depends”. The next optimal answer is “it would be nice to have all of them”. In reality, after debating briefly, I picked team.

There is no right or wrong answer, but for me, I will probably pick team over anything else. In an ideal team, or in our Prelinked team, the team is:
– well balanced. Each team member has his own expertise.
– team members are willing to help each other. After he is done with his share of work, he will voluntarily help other team members.
– he works hard because of self-motivation. He should have a high bar in terms of quality of his own work, and he will drive himself to meet that bar.
– he is fun to work with. That is what will get the team through tough nights.

Standard

# All anagrams of a string

Extremely common interview question. You should be able to write it when you are dreaming

```var output = [];
var walker = function(prefix, bag){
var n = bag.length;
if(n===0){
output.push(prefix);
console.log(prefix);
}
for(var i=0; i<n; i++){
walker(prefix+bag[i], bag.substring(0,i)+bag.substring(i+1,n));
}
};
walker('','abc');
```

To find a job, you should really be able to write this when you are dreaming. I am serious.

Well, there are cases that your interviewer wants the following version for performance reasons. You are welcome. The code is largely based on this article. The ideas are:

• Try each of the letters in turn as the first letter and then find all the permutations of the remaining letters using a recursive call.
```
var output = [];

var swap = function(arr, from, to){
var tmp = arr[from];
arr[from] = arr[to];
arr[to] = tmp;
};

var walker = function(str, index){

if(index>=str.length){
output.push(str);
console.log(str);
return;
}

for(var i=index; i<str.length; i++){
swap(str, index, i);
walker(str, index+1);
swap(str, index, i);
}

};

walker(['a','b','c'], 0);
```
Standard

# How to speed up page load

This is probably one of the most frequently asked non-data structure questions in my interviews. My answers are:

• DNS speed. Depending on who is hosting the DNS for you, there might be speed implications. The famous one is, GoDaddy’s DNS server is sometimes unreachable inside China. So, if you want to serve the Chinese market, maybe you should think about DNSPod.
• Gzip the traffic. Most web servers and browsers support compression such as gzip. Read more on this article
• Size of the
• HTML, reduce unecessary markups
• CSS, minify, uglify
• JS, minify, uglify
• Images, compression, trying to serve different sizes for mobile website
• Number of HTTP requests
• CSS, combining all into one file
• JS, combining all into one file
• Images, CSSsprite, combining many small images into one
• Cacheing
• Set expiration headers for all assets, and let them expire way in the future
• If anything needs to be changed, change the url of the assets. I.e. changing from adfafa.css to adfjileafs.css

Standard

# More closure

The third time in an interview to be asked about closure. All three questions are very similar. While I did well in the last couple of times, I was over-confident and shoot myself in the foot this time. Oh well…

Oh, more and more people are getting offers now. The inflow rate of offers is surreal….

Standard

# CDN works

More interviews.

One of the questions are related to how to scale a website to handle 5x of its load in a month. The answer is, you guessed it, CDN. The basic idea is similar to what DealsVista has done in the past: converting dynamic content to html/css/js, serving from local harddrive first, then local ram, then serving from CDN when larger traffic is expected.

Standard