Millennium Management Full Stack Engineer 视频面试经验
面试详情
就45min, 老殷,说只招一个岗
项目
问了问项目,他语言表达能力是真模糊啊,自己问问题不清楚,然后也感觉对我没啥兴趣
问service communication protocols with client side, scalability
Coding
给了三段代码
第一段代码
java
public class Numeric {
public static void main(String[] args) {
double a = 0.9 - 0.8;
double b = 0.8 - 0.7;
System.out.println((float) a); // 0.1
System.out.println((float) b); // 0.1
System.out.println(a == b); // false
System.out.println(a == b);
}
}print值多少?
fix, 如何让a等于b?
第二段代码
java
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Objects;
class Point {
int x, y;
Point(int x, int y) { this.x = x; this.y = y; }
@Override
public int hashCode() {
return Objects.hash(x, y);
}
@Override
public boolean equals(Object o) {
if (!(o instanceof Point)) return false;
Point p = (Point) o;
return x == p.x && y == p.y;
}
@Override
public String toString() {
return "(" + x + ", " + y + ")";
}
}
public class PointTest {
public static void main(String[] args) {
Collection<Point> set = new HashSet<>();
Collection<Point> list = new ArrayList<>();
Point p = new Point(1, 1);
set.add(p);
list.add(p);
System.out.println(set.contains(p)); // true
System.out.println(list.contains(p)); // true
p.x = 2;
Point p2 = new Point(2, 1);
System.out.println(set.contains(p2)); // true
System.out.println(set.contains(p)); // true
System.out.println(list.contains(p)); // true
set.remove(p);
System.out.println(set); // {}
}
}print多少,
改一个值和新加一个obj,print什么
第三段代码
java
import java.util.HashMap;
import java.util.Map;
public class SessionCache {
static boolean stopped;
static class Key {
Integer id;
Key(Integer id) { this.id = id; }
@Override public int hashCode() { return id.hashCode(); }
}
public static void main(String[] args) {
Map<Key, String> cache = new HashMap<>();
new Thread(() -> {
try {
Thread.sleep(24 * 60 * 60 * 1000);
stopped = true;
} catch (Exception e) {
} finally {
stopped = true;
}
}).start();;
int i = 1;
while (!stopped) {
cache.put(new Key(i % 5000), "DATA" + i);
i++;
}
}
// max / min value of key.id
// num elements in the cache
// how ling this program runs
}
