BB bloomberg电面

今天刚面完BB的电面,感觉凉凉,面试官听口音是个白人小哥,感觉十分nice,虽然test cases没有全过还让我不要feel bad about it,说已经很close了,还说很多人都到这一步 。。。简历随便问了问,然后问了一些java basics和ood
只有一道题。。。。input两个string,问前一个string里面有多少个words不是第二个string里的subsequence(这个subsequence这个词用的嗯感觉并不是很严谨),区分大小写
比如
s = I am using Java Java is a programming language
t = using Java programming
output should be:
[I, am, is, a, language]
开始不敢相信这么简单,结果哈哈哈哈哈哈哈分分钟教做人
test case只过了一半 ,小哥说是有一个edge case我没考虑到,还说让我考虑string结束了,到end了的情况怎么办(我还是没有get到他这个hint),结束以后还好心的给我贴了一个我没过的case,我下线了以后在ide里跑了一下,是我expect的output,所以我开始怀疑我到底有没有读懂题目 。。。
开始陷入纠结,各位大神们有知道这个flaw在哪里麻烦告诉我!!感谢!!
这个是没过的case:
Python is an easy to learn powerful programming language It has efficient high-level data structures and a simple but effective approach to objectoriented programming Python elegant syntax and dynamic typing
Python is an easy to learn powerful programming language
我写的代码

	public static List<String> missingWords(String s, String t) {
		List<String> result = new ArrayList<>();
		if (s == null || t == null || s.length() == 0 || t.length() == 0) {
			return result;
		}
		String[] array = t.split(" ");
		Set<String> set = new HashSet<>();
		for (String str : array) {
			set.add(str);
		}
		String[] input = s.split(" ");
		for (String inputStr : input) {
			inputStr.trim();
			if (!set.contains(inputStr)) {
				result.add(inputStr);
			}
		}
		return result;
	}

	public static void main(String[] args) {
		String s = "Python is an easy to learn powerful programming language It has efficient high-level data structures and a simple but effective approach to objectoriented programming Python elegant syntax and dynamic typing";
		String t = "Python is an easy to learn powerful programming language";
		System.out.println(missingWords(s, t));
	}

补充一个:

The entire interview was done over a online code editor. It took less than an hour total, including the questions I had for my interviewer.

  • Behavioral questions
    • Tell me about your background.
    • Tell me about a framework you learned recently.
  • Technical questions
  1. Find the first unique element in an array of unique and duplicate elements.

Initially used a counter hash to count all the elements and do another pass and return the first unique element (O(n) time/space).

Then they asked me to do it without a counter hash so I used a hash keeping the indices and updating the key/value pair as I hit them (Still O(n) time/space).

I did mention using XOR for duplicate elements occuring at most twice/even numbers and sorting the array and returning the first element that doesn’t repeat (O(1) space but O(n) and O(nlogn) time respectively).

  1. https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/

Except singly-linked but done the same way. Used recursion initially returning the tail instead of the head but switched to using a stack once I realized it was just a simple dfs traversal on a binary tree.

也报一个

image