← Bank of America Interview Insights

Bank of America·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Onsite at a hedge fund, got hit with a math/logic puzzle I'd never seen before and completely froze. Not on leetcode, not anywhere I'd practiced. Still not sure if my solution attempt even made sense.

Questions Asked (1)

Q1

Given a number of days, a max ascend distance per day, and a max descend distance per day, find the maximum elevation you can reach at any point, given that you must return to your starting elevation by the end of all days. On any given day you can only go up or down (not both), and you don't have to use the full distance.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I blanked.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints and edge cases. Then, derive a mathematical formula for the maximum elevation: it is the minimum of (days/2 * maxAscend) and (days/2 * maxDescend), assuming days is even. If days is odd, the maximum is 0 because you cannot return to start. Finally, explain the reasoning and discuss potential optimizations or trade-offs.

Pro tip: Demonstrate strong problem-solving by explicitly handling the odd-days case and discussing how the solution scales with large inputs, showing awareness of efficiency.

1. Clarify the problem

Ask clarifying questions to ensure you understand the constraints: Can you change direction mid-day? Is the starting elevation fixed? Are days, maxAscend, and maxDescend integers? Confirm that you must end at the starting elevation.

2. Identify the key insight

Recognize that to maximize peak elevation, you should ascend as much as possible on half the days and descend as much as possible on the other half. The peak is limited by both the total ascent possible and the total descent possible.

3. Derive the formula

If the number of days is even, the maximum elevation is min((days/2)*maxAscend, (days/2)*maxDescend). If days is odd, it's impossible to return to start, so the answer is 0.

4. Validate with examples

Test the formula with small examples, such as days=2, maxAscend=5, maxDescend=3, to ensure it yields the correct result (3). Also test odd days to confirm 0.

5. Discuss complexity and edge cases

Mention that the solution is O(1) time and space. Discuss edge cases: days=0, negative or zero maxAscend/maxDescend, and very large numbers (potential overflow).

Key Points to Mention

  • The need to return to the starting elevation implies symmetry in ascent and descent days.
  • The maximum elevation is constrained by both the maximum ascent and maximum descent capabilities.
  • Odd number of days makes it impossible to return to start, so the answer is 0.
  • The solution can be computed in constant time with a simple formula.
  • Edge cases such as zero days, zero distances, and large inputs should be considered.
  • The problem can be framed as an optimization problem with constraints.

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