Mutual friends
What this preview is
Mutual friends is a hard quant interview question on language knowledge in Python.
- Difficulty
- Hard
- Topic
- Language Knowledge
- Discipline
- Quant development
- Language
- Python
- Companies
- 0
What this Python typing question tests
This is a hard Python question that probes your understanding of how modern typecheckers (such as mypy or Pyright) infer and track types through code. It rewards fluency with Python's type system, including generics, type narrowing, and the distinction between runtime and static analysis.
To answer correctly, you need to trace through a code snippet and reason about what a typechecker would conclude about a specific variable or expression. This requires understanding how type inference works in context—including how assignments, operations, and control flow affect the inferred type at each point in the program. Firms use questions like this to identify candidates who think carefully about type safety and can predict static-analysis behavior without running the code.
- Type inference and inference rules
- Generic types and type parameters
- Type narrowing and control-flow analysis
- Differences between static and runtime types
Related practice
Unlock full access to getcracked
Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.