← Bank of America Interview Insights

Bank of America·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Quant engineer interview, one coding problem, nothing too wild but the DP angle was a bit unexpected for this role.

Questions Asked (1)

Q1

Given a binary matrix, find the area of the largest square containing only 1s.

Algorithms & Data Structures
Author's notes

Classic DP problem but I still fumbled the recurrence for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use dynamic programming to compute the size of the largest square ending at each cell, then return the square of the maximum size. Explain the recurrence dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1 when matrix[i][j] == 1, and handle edge cases.

Pro tip: In banking, emphasize the O(m*n) time and O(n) space optimization, and discuss how this scales for large transaction matrices. Also mention that you validate inputs and consider memory constraints.

1. Clarify the problem

Confirm the definition of a square (contiguous 1s), input format (binary matrix), and expected output (area, not side length). Ask about constraints on matrix size.

2. Discuss brute force and optimal approach

Mention brute force O(m^2 n^2) and then propose dynamic programming for O(m*n) time. Explain why DP is better for large matrices.

3. Explain the DP recurrence

Define dp[i][j] as the side length of the largest square ending at (i,j). If matrix[i][j] == 1, dp[i][j] = min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1; else 0.

4. Walk through an example

Trace the DP on a small matrix (e.g., 3x3) to show how the recurrence works and how the maximum side length is tracked.

5. Analyze complexity and optimize space

State time O(m*n) and space O(m*n) for 2D DP, then mention space optimization to O(n) using a 1D array or rolling rows.

Key Points to Mention

  • Dynamic programming state definition and recurrence relation
  • Time and space complexity analysis (O(m*n) time, O(n) space optimized)
  • Handling edge cases: empty matrix, all zeros, single row/column
  • Space optimization using 1D array or two rows
  • Comparison with brute force approach
  • Potential applications in banking (e.g., fraud detection patterns)

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