注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
Round 1, General Coding:
Q1: input Array: [ 0.1, 0.2, 18.9, 17.5, 14.3, 12.1, 0.9,10.9] Output: 0.1
find X in Array, in the range [X, X+1) contains maximum numbers of the array.
contains 3 numbers: 0.1, 0.2, 0.9…….[10.9, 11.9) contains 10.9...... return 0.1
Q2.
Round 2, General Coding:
Q1,
Q2. genrate a binary string which have k 1, and the length is n. For example, if n = 4 and k = 2, the answer is:
'0011', '1100', '1010'.............
def generateStrings(prefix, n, k) -> String:
if (k == 0):
print prefix + (n) * '0''
return
if (n == k):
print prefix + (n * "1")
return
generateStrings(prefix + "0", n-1, k)
generateStrings(prefix + "1", n-1, k-1)
generateStrings('', n, k)
Follow ups: How to accelerate it if you have thousands of macines?
Round 3, Machine Learning:
Give a lot of car images, classify whether the image includes wheel.
It's a binary classification problem. I proposal to use CNN, the interviewer asked me why not use SVM, I elaborated SVM needs manually design features, and raw image would be too large to input it to the SVM.. I feel the answer is not the best, but interviewer not continue asks. The interviewer also asked how to locate the the place of the wheel, I propose faster-cnn, then the interviewer asked me how to classify it's a front left wheel or right bottom wheel, I answered faster-rcnn with 4 classes.
After that,the interviewer mainly asked me to implement details for how to train a CNN model, after I finsihed the code, the interviewer asked me what if your model have a good accuracy during training but performance poorly in the customer side? I propose to investigate the reason, not sure if it is the answer he is looking for.
class LinearClassifier(object):
def __init__(self):
self.W = None
def train(self, X, y, learning_rate=1e-3, reg=1e-5, num_iters=100,
batch_size=200, verbose=False):
"""
Train this linear classifier using stochastic gradient descent.
Inputs:
- X: A numpy array of shape (N, D) containing training data; there are N
training samples each of dimension D.
- y: A numpy array of shape (N,) containing training labels; y[i] = c
means that X[i] has label 0 <= c < C for C classes.
- learning_rate: (float) learning rate for optimizat+1) * (x2 - x1 + 1)
var = 0
/n repeat (y2-y1+1) * (x2-x1+1)
for i in range(y1, y2+1):
for j in range(x1, x2+1):
var += (image[i][j] - mean)**2
var /= n
return var
(image[i][j] - mean)**2 = image[i][j] ** 2 - mean ** 2
region = [x1, y1, x2, y2]
mean = (dp[x2, y2] - dp[x1, y2] - dp[x2, y1] + dp[x1, x2]) / ((x2 - x1 + 1) * (y2 - y1 +1))
squaredsum = (dp2[x2, y2] - dp2[x1, y2] - dp2[x2, y1] + dp2[x1, x2]) / ((x2 - x1 + 1) * (y2 - y1 +1))
follow ups, How to scale it up if we need to compute it 1 billion times?
I propose use to dp table store the accumulate sum of the left top elements,
such as dp, dp2 with same size of the image[hxw], dp[i][j] is the accumulate sum of image[:i+1][:j+1]
dp2[i][j] is the accumulate squared sum of image[:i+1][:j+1]**2….
Round 5, Behavior:
A difficult situation in one year, how you combat it?
How you make a different in you expertise area?
What you will do now, regarding your past project?
A time you have very negative feedback to your colleague?
A time you received a negative feedback?
How you handle tight deadline?
How you implement a general requirement from your manager? I answered firstly discuss the details with manager, figure out what my manager really want, how I can do in practicaly.
What if you want high quality code but your manager wants the project deliver fast?
|