Sitemap
Kavya Sri

Kavya Sri

Software engineer, writing down what I've actually learned along the way — about AI, careers, and the parts of this industry nobody explains to you upfront.

image by author

Member-only story

J.P. Morgan iOS Developer Interview

The 15 Questions That Nearly Broke Me

4 min readSep 30, 2026

--

Round 1: Online Assessment (HackerRank — 90 minutes)

This round was purely code and fundamentals. Two main coding problems + 10 multiple-choice questions on Swift, iOS, and general CS.

DSA Question 1: Fraud Detection in Transactions

Problem:
You receive a list of transactions with (cardNumber, country, timestamp). Detect if the same card is used in two different countries within 5 minutes.

Thought Process:

  1. Sort transactions by timestamp.
  2. Store last transaction in a dictionary keyed by card number.
  3. Compare current with last — if countries differ and time gap ≤ 5 minutes, return true.

Swift Solution:

struct Transaction {
let card: String
let country: String
let time: Date
}

func detectFraud(transactions: [Transaction]) -> Bool {
var lastUse: [String: (String, Date)] = [:]
let sortedTransactions = transactions.sorted { $0.time < $1.time }

for t in sortedTransactions {
if let (lastCountry, lastTime) = lastUse[t.card] {
let diff =…

--

--

Kavya Sri
Kavya Sri

Written by Kavya Sri

Software engineer, writing down what I've actually learned along the way — about AI, careers, and the parts of this industry nobody explains to you upfront.