Skip to content

Deutsche Bank Coding Questions

Practice Deutsche Bank coding questions for investment banking tech roles (campus OA + interview). Focus on optimal solutions, clean code, and finance-flavored constraints candidates report in Deutsche Bank DSA / OA rounds.

def max_profit(prices):
min_price = float('inf')
max_profit = 0
for price in prices:
if price < min_price:
min_price = price
elif price - min_price > max_profit:
max_profit = price - min_price
return max_profit
def two_sum(nums, target):
seen = {}
for i, num in enumerate(nums):
complement = target - num
if complement in seen:
return [seen[complement], i]
seen[num] = i
return []
def is_valid(s):
stack = []
mapping = {')': '(', '}': '{', ']': '['}
for char in s:
if char in mapping:
top = stack.pop() if stack else '#'
if mapping[char] != top:
return False
else:
stack.append(char)
return not stack
def merge(intervals):
intervals.sort(key=lambda x: x[0])
merged = []
for interval in intervals:
if not merged or merged[-1][1] < interval[0]:
merged.append(interval)
else:
merged[-1][1] = max(merged[-1][1], interval[1])
return merged
def max_subarray(nums):
max_sum = current_sum = nums[0]
for num in nums[1:]:
current_sum = max(num, current_sum + num)
max_sum = max(max_sum, current_sum)
return max_sum
def coin_change(coins, amount):
dp = [float('inf')] * (amount + 1)
dp[0] = 0
for i in range(1, amount + 1):
for coin in coins:
if coin <= i:
dp[i] = min(dp[i], dp[i - coin] + 1)
return dp[amount] if dp[amount] != float('inf') else -1
import bisect
def length_of_lis(nums):
tails = []
for num in nums:
pos = bisect.bisect_left(tails, num)
if pos == len(tails):
tails.append(num)
else:
tails[pos] = num
return len(tails)
from collections import OrderedDict
class LRUCache:
def __init__(self, capacity):
self.cache = OrderedDict()
self.capacity = capacity
def get(self, key):
if key not in self.cache:
return -1
self.cache.move_to_end(key)
return self.cache[key]
def put(self, key, value):
if key in self.cache:
self.cache.move_to_end(key)
self.cache[key] = value
if len(self.cache) > self.capacity:
self.cache.popitem(last=False)
from collections import deque
def level_order(root):
if not root:
return []
result = []
queue = deque([root])
while queue:
level = []
for _ in range(len(queue)):
node = queue.popleft()
level.append(node.val)
if node.left:
queue.append(node.left)
if node.right:
queue.append(node.right)
result.append(level)
return result
def is_valid_bst(root, min_val=float('-inf'), max_val=float('inf')):
if not root:
return True
if root.val <= min_val or root.val >= max_val:
return False
return (is_valid_bst(root.left, min_val, root.val) and
is_valid_bst(root.right, root.val, max_val))

Additional Deutsche Bank coding questions candidates report in OA and tech rounds - finance-flavored wrappers on standard DSA.

import math
def has_arbitrage(currencies, rates):
# rates[i] = (u, v, r) means 1 u -> r v
# Bellman-Ford on -log(rate); negative cycle => arbitrage
n = len(currencies)
idx = {c: i for i, c in enumerate(currencies)}
dist = [0.0] * n
edges = [(idx[u], idx[v], -math.log(r)) for u, v, r in rates]
for _ in range(n - 1):
for u, v, w in edges:
if dist[v] > dist[u] + w:
dist[v] = dist[u] + w
for u, v, w in edges:
if dist[v] > dist[u] + w + 1e-12:
return True
return False
import heapq
class OrderBook:
def __init__(self):
self.buys = [] # max-heap via negation
self.sells = [] # min-heap
def add_buy(self, price, qty):
heapq.heappush(self.buys, (-price, qty))
def add_sell(self, price, qty):
heapq.heappush(self.sells, (price, qty))
def best_bid_ask(self):
bid = -self.buys[0][0] if self.buys else None
ask = self.sells[0][0] if self.sells else None
return bid, ask
def min_prefix_capital(cashflows):
# Minimum starting capital so running balance never goes negative
bal = 0
mn = 0
for x in cashflows:
bal += x
mn = min(mn, bal)
return max(0, -mn)
import heapq
import StructuredData from '../../../components/StructuredData.astro';
<StructuredData
type="BreadcrumbList"
breadcrumbs={[
{ name: "Home", url: "/" },
{ name: "Companies", url: "/" },
{ name: "Deutsche Bank Placement Papers", url: "/deutsche-bank/" },
{ name: 'Coding Questions', url: "/deutsche-bank/coding-questions/" }
]}
/>
<StructuredData
type="WebPage"
webPage={{
name: 'Deutsche Bank Coding Questions',
description: 'Coding interview questions with solutions for investment banking tech roles 2025.',
url: 'https://placementpapers.app/deutsche-bank/coding-questions/',
isPartOf: {
name: "Placement Papers",
url: "https://placementpapers.app"
}
}}
/>
def k_closest(prices, target, k):
# return k prices closest to target
return heapq.nsmallest(k, prices, key=lambda p: (abs(p - target), p))
OA tip: How Deutsche Bank coding rounds differ from pure LeetCode
  • Problems are still DSA (arrays, heaps, graphs, DP) - wrappers may mention trades, FX, or settlement.
  • Partial credit varies; prefer a correct O(n log n) over a broken “optimal” idea.
  • Be ready to explain complexity and edge cases (empty book, zero rates, duplicate timestamps) in the interview after OA.

Goldman Sachs · JP Morgan · Morgan Stanley · Bank of America · Capital One · Wells Fargo


Master DSA + finance basics for banking tech roles!