Skip to content

Bank of America Coding Questions - DSA Problems & Solutions

Practice Bank of America placement paper coding questions with detailed solutions. Access Bank of America OA coding problems in Java, Python.

This page contains Bank of America coding questions from Bank of America OA placement papers with detailed solutions.

Bank of America OA Coding Section:

  • Problems: 2-3 coding problems
  • Time: 90 minutes
  • Languages: Java, Python
Q1: Manage multiple bank accounts with balance updates and transaction history.

Solution (Java):

class BankAccountManager {
Map<String, Double> accounts = new HashMap<>();
Map<String, List<Transaction>> history = new HashMap<>();
public boolean transfer(String from, String to, double amount) {
if (!accounts.containsKey(from) || !accounts.containsKey(to)) {
return false;
}
double fromBalance = accounts.get(from);
if (fromBalance < amount) return false;
accounts.put(from, fromBalance - amount);
accounts.put(to, accounts.get(to) + amount);
history.putIfAbsent(from, new ArrayList<>());
history.putIfAbsent(to, new ArrayList<>());
history.get(from).add(new Transaction("DEBIT", amount));
history.get(to).add(new Transaction("CREDIT", amount));
return true;
}
public double getBalance(String accountId) {
return accounts.getOrDefault(accountId, 0.0);
}
}

Time Complexity: O(1) per transaction


Practice Bank of America coding questions regularly!