Implement a queue which has addFront, addBack, popFront, popBack, and getSize in O(1).
Find out how close two words are to being anagrams of each other. A string s1 is an anagram of another string s2 if the same characters exist in both s1 and s2 in any order. Write a function which accepts two strings, and returns the minimum number of letters that must be changed to make a word an anagram of another.
For example, to make 'bond' an anagram of 'down' you need to change 1 letter: 'b' to 'w'.
If either string contains a number or the strings are different lengths, throw an exception.
Implement a ride(desert, gas) method that returns true if a car can reach an oasis before it runs out of gas and false otherwise. The car can drive in four directions: top, bottom, left, right. Moving one field requires one unit of gas.
The desert is a 2D m x n array with five types of fields:
'c': the starting point of the car'o': the oasis, our destination'.': sand, the car can drive through it
ride(desert, 3) => false
ride(desert, 5) => true
Given a string that may contain brackets, and no unbalanced brackets, find the substring(s) within the most deeply nested balanced bracket(s). The following sets of characters should be considered as open/close brackets respectively: (), [], {}.
If there are multiple sets of brackets with the same highest depth, your function should return all substrings. If there are no brackets in the string, then your function should return the entire input string.
"ab(c(d)e)" -> "d"
"[a{b}c]d(e)" -> "b"
"((a)b(cd)ef)" -> "a", "cd"
"(ab[c]{d{e}})" -> "","e""Hello, World!" -> "Hello, World!"
这组 Bloomberg / VO 面试题主要考察对基础数据结构、字符串处理和图搜索的掌握。第一个题目要求在 O(1) 时间支持双端入队和出队,通常需要用双向链表或双端队列来维护头尾操作;第二题是判断两个字符串“离变成异位词还差多少步”,核心是统计字符频次差异并处理长度不一致或非法字符的异常;第三题是在二维网格中判断能否在油量耗尽前到达绿洲,本质上是带步数限制的 BFS/DFS 可达性问题;最后一个题目要求找出最深层括号内的子串,需要用栈记录括号层级并提取最大深度对应的内容。整体来看,这类题目强调边界条件、输入校验和正确选择线性或图遍历结构。