Question 1: String Replace Without Using Built-in Functions
Implement a function that will take three Strings as arguments and return the first string
with all instances of the second string replaced by the third string.
Do not use any of the standard regexp functions or string replace functions.
Example:
replace("AFoxRunsInTheField", "Fox", "Cat") => "ACatRunsInTheField"
Restriction: don't use string.replace or regex replace
Question 2: LinkedIn Connection Distance
LinkedIn is designed to connect people together, so that in people search and other related
areas LinkedIn will show a connection distance between two users.
E.g., Bob connects with Alice, and Alice connects with Frank, assuming there is no other
connections, then Bob and Frank's connection distance is 2.
interface MemberConnections {
// given a member, it will return all his/her connections,
// if no connections, the list is an empty list
List<Member> getConnections(Member member);
}
interface Member {
// a person's name
String getName();
// a unique member id
int getMemberId();}
// please implement
interface FindConnectionDistance {
/**
* get connection distance between two members
*/
int calculateConnectionDistance(Member member1, Member member2);
}
这组题是 LinkedIn 非常典型的 “基础实现 + 图搜索建模” 组合考察。第一题考的是字符串底层处理能力,重点在于指针移动和边界控制;第二题则本质是无权图上的最短路径问题,面试官更关注你是否能快速抽象成图模型并解释搜索策略。在 VO 面试中,这类题非常依赖思路表达和实时澄清能力。
VOprep 团队长期陪同学员实战各类大厂 OA 与 VO,包括 OpenAI、Google、Amazon、Citadel、SIG 等,提供、面试辅助、代面试,帮助大家在拿 offer。
正文完