← Deutschebank Interview Insights

Deutschebank·Software Engineer·Online Assessment (OA)·Intermediate

Intermediate
Jul 2026

Summary

Deutsche Bank software engineer interview with two back-to-back coding problems, pretty standard algorithmic stuff. They also wanted test cases written out for each solution, which I wasn't fully expecting.

Questions Asked (2)

Q1

Given the roots of two binary trees, write a function that returns true if the trees are structurally identical and all corresponding node values match.

Algorithms & Data Structures
Author's notes

Recursive solution felt natural here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem and edge cases, then propose a recursive solution that compares the current nodes and recursively checks left and right subtrees. Discuss time and space complexity, and mention iterative alternatives if relevant.

Pro tip: Emphasize early termination on mismatch to optimize performance, and relate the problem to real-world scenarios like data validation in financial systems to show practical insight.

1. Clarify the problem

Ask clarifying questions to ensure you understand the requirements, such as handling null trees, empty trees, and whether the trees are binary search trees or just binary trees.

2. Outline the approach

Explain that you will use a recursive depth-first traversal to compare nodes, checking for structural and value equality at each step.

3. Detail the algorithm

Describe the base cases: if both nodes are null, return true; if one is null, return false; if values differ, return false. Then recursively check left and right subtrees.

4. Analyze complexity

State that the time complexity is O(n) where n is the number of nodes, as each node is visited once, and space complexity is O(h) for recursion stack, where h is the height of the tree.

5. Discuss alternatives and edge cases

Mention iterative approaches using stacks or queues, and discuss edge cases like very deep trees causing stack overflow, and how to handle them.

Key Points to Mention

  • Recursive depth-first traversal
  • Base cases for null nodes and value mismatch
  • Time complexity O(n) and space complexity O(h)
  • Early termination on mismatch
  • Iterative alternative using stack/queue
  • Handling of edge cases (empty trees, single node, skewed trees)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Write a function to check whether a string of brackets is valid, meaning every opening bracket is closed by the correct type in the correct order.

Algorithms & Data Structures
Author's notes

Stack problem, classic.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: confirm the bracket types (e.g., (), [], {}) and that the string contains only brackets. Then explain that a stack is the ideal data structure because it naturally handles the LIFO order of nested brackets. Walk through the algorithm: iterate through the string, push opening brackets onto the stack, and for closing brackets, check if the stack is non-empty and the top matches; finally, ensure the stack is empty.

Pro tip: Mention edge cases upfront (empty string, odd length, strings with non-bracket characters) and discuss time/space complexity (O(n) time, O(n) space) to show thoroughness. Also, briefly note that this approach can be extended to handle multiple bracket types and is used in real-world parsers.

1. Clarify requirements and constraints

Ask if the string contains only brackets, which bracket types to support, and whether an empty string is considered valid. Confirm that brackets must be properly nested and closed in the correct order.

2. Choose the right data structure

Explain that a stack is ideal because it follows Last-In-First-Out (LIFO) order, which matches the nesting of brackets. Mention that a hash map can map closing brackets to their corresponding opening brackets for quick lookup.

3. Outline the algorithm

Iterate through each character: if it's an opening bracket, push it onto the stack; if it's a closing bracket, check if the stack is empty or the top doesn't match, then return false. After the loop, return true only if the stack is empty.

4. Analyze complexity and edge cases

State that time complexity is O(n) because each character is processed once, and space complexity is O(n) in the worst case (e.g., all opening brackets). Discuss edge cases: empty string (valid), odd length (invalid), and strings with non-bracket characters (if allowed, ignore or handle accordingly).

5. Test with examples

Walk through a few examples: '()' -> true, '([)]' -> false, '{[]}' -> true, and an empty string -> true. This demonstrates correctness and helps catch off-by-one errors.

Key Points to Mention

  • Use a stack to track opening brackets and ensure proper nesting.
  • Map closing brackets to opening brackets for efficient matching.
  • Check for empty stack when encountering a closing bracket to avoid errors.
  • Ensure the stack is empty at the end to confirm all brackets are closed.
  • Time complexity: O(n) where n is the length of the string.
  • Space complexity: O(n) in the worst case due to stack usage.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.