Citadel software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
No verified questions yet for Citadel.
add_rate(base, quote, rate) proposes the relationship 1 unit of base = rate units of quote. Accepted relationships support reciprocal and transitive conversions. Rates are synthetic inputs, not executable market quotes; ignore spreads, fees, timestamps, and rounding to currency minor units.abs(rate - implied_rate) <= 1e-9 * max(rate, implied_rate). Return true for a consistent proposal but retain the existing implied relationships. Return false for an inconsistent proposal, without adding any currencies or changing any implied relationships.1.0, even if that currency is unknown: a consistent proposal registers the currency, while an inconsistent one does not.get_rate and convert return null when either currency is unknown or the currencies are disconnected. A known currency converts to itself at rate 1.0; an unknown currency does not. Conversion is linear: converted_amount = amount * implied_rate.ValueError, and invalid insertions must not change the book. Validate all arguments before checking connectivity.CurrencyConverter() — construct an empty book.add_rate(base: str, quote: str, rate: float) -> bool — accept or reject a proposed relationship according to the rules above.get_rate(base: str, quote: str) -> Optional[float] — return the implied quote units per base unit, or None if unavailable.convert(base: str, quote: str, amount: float) -> Optional[float] — convert an amount, or return None if unavailable.currencies() -> List[str] — return all registered identifiers in ascending lexicographic order.[ ["add_rate", "USD", "EUR", 0.8], ["add_rate", "EUR", "JPY", 150.0], ["get_rate", "USD", "JPY"], ["convert", "JPY", "USD", 24000.0], ["add_rate", "USD", "JPY", 121.0], ["get_rate", "USD", "JPY"], ["currencies"] ]
[true, true, 120.0, 200.0, false, 120.0, ["EUR", "JPY", "USD"]]
0.8 * 150 = 120 JPY, so 24000 / 120 = 200 USD. The proposed rate of 121 contradicts the established snapshot and is rejected.Example 2:[ ["get_rate", "USD", "USD"], ["add_rate", "CHF", "CHF", 2.0], ["currencies"], ["add_rate", "USD", "EUR", 0.5], ["add_rate", "GBP", "JPY", 4.0], ["convert", "USD", "JPY", 10.0], ["add_rate", "EUR", "GBP", 2.0], ["convert", "USD", "JPY", 10.0], ["add_rate", "CHF", "CHF", 1.0], ["convert", "CHF", "CHF", 7.0] ]
[null, false, [], true, true, null, true, 40.0, true, 7.0]
0.5 * 2 * 4 = 4 JPY, so ten USD converts to 40 JPY. Registering CHF with a self-rate of 1 permits identity conversion.Constraints1e12; proposed rates and all implied ratios remain between 1e-12 and 1e12.1e-9 and absolute tolerance 1e-9; proposal acceptance uses only the relative formula specified above.currencies() method.Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free