
Recently interviewed with jane street for a 5 round interview and the interviewers were very friendly.
The first round was the Take Home test, and I opened the file to find it was all familiar past work, and was secretly glad to be off to a good start.
The second round was a thirty-minute phone interview with HR, and after the regular questions there were actually a couple of Brain Teaser hits, which were overwhelming and full of surprises.
The third round was an hour long Numeracy challenge where the interviewer's first question was to count how many plastic bags there are in a city. After we finished, we were then asked to count how many fours there were to the tune of 1,000 miles, and luckily we didn't miscalculate.
Fourth round of one-hour resume deep dives. This round was relatively uneventful, mainly asking about past experience. However, a question about "short selling" popped up, but it was a good one.
The fifth round of the two-and-a-half-hour technical test was divided into two consecutive interviews. The first one went well, the second interviewer pulled out Excel and asked us to dictate her operation, there was a communication misunderstanding during the process, some steps got stuck, the interviewer and we were quite uncomfortable, the atmosphere was tense all of a sudden.
Code questions from the Jane street interview process are shared below.
Jane street Coding 1: LeetCode 443
Given an array of characters, compress it using the following algorithm: begin with the empty string s. For each group of consecutively repeating characters in the character:
If the length of the group is 1, append the character to s. Otherwise, append the length of the group after the character
from typing import List
def compress(chars: List[str]) -> str:
chars.append("") # 添加一个哨兵字符
s = ""
count = 1
curr = chars[0]
for i, c in enumerate(chars):
if not i:
continue
if c == chars[i - 1]:
count += 1
else:
s += curr
if count > 1:
s += str(count)
curr = c
count = 1
return s
Jane street Coding 2
Please implement a Character Stream Compression Class, the class supports multiple iterations and can compress the input string.
The compression rules are as follows:
- Records only the number of consecutive occurrences of a character and stores the result in a string.
- Only the last character and its repetition number are recorded.
- Each time the
compress()methods are compressed based on the current input string.
Example:
compress('aabb') -> 'a2'
compress('bcccdddd') -> 'b1c3d4'
class StringCompressor:
def __init__(self):
self.last_char = "" # 记录上次处理的字符
self.count = 0 # 记录字符出现次数
def compress(self, s: str) -> str:
if not s:
return ""
compressed = ""
self.last_char = s[0]
self.count = 1
for i in range(1, len(s)):
if s[i] == self.last_char:
self.count += 1
else:
compressed += self.last_char + str(self.count)
self.last_char = s[i]
self.count = 1
# 记录最后一个字符的计数
compressed += self.last_char + str(self.count)
return compressed
Follow up question. Implements the same class as before, but each input has an index indicating its order. Need to use dict to store indexes and inputs.
Example:
- compress(‘deef’, 3) -> “”
- compress(‘bbcc’, 1) -> “”
- compress('ab', 0) -> 'a1b1'
- compress('ccdd', 2) -> 'c2d2'
class IndexedStringCompressor:
def __init__(self):
self.data = {} # 用于存储不同索引的字符串状态
def compress(self, s: str, index: int) -> str:
if index not in self.data:
self.data[index] = ""
# 更新该索引的字符串
self.data[index] += s
# 执行压缩逻辑
compressed = ""
last_char = self.data[index][0]
count = 1
for i in range(1, len(self.data[index])):
if self.data[index][i] == last_char:
count += 1
else:
compressed += last_char + str(count)
last_char = self.data[index][i]
count = 1
# 记录最后一个字符的计数
compressed += last_char + str(count)
return compressed
Reference
Jane street interview | Acreage
After our powerfulVO-assisted surrogate surfaceThrough the analysis and communication of these interview questions, the interviewer not only understands the candidate's programming ability, but also sees the clear thinking and effective communication skills in the problem solving process. I wish you all a successful interview!