Java. Job 10454435 still none. Full class notes: study book ch. 02. This chapter is the later-loop pack. Labels: IE-asked Standard CS.
Conflict you already know: some dumps say SDE I gets Parking Lot; others say Trie+Heap DS-design only. Bible §5.C has both. UTA Rank A is mostly two-DSA. Walk in able to draw classes and to combine HashMap + heap + list. Do not spend the week on Amazon.com HLD.
Prince R1 Job 3057703; Uday Singh LinkedIn R2 locker. Not UTA-default, still the cleanest locker sketch.
enum Size { S, M, L }
class Package { String id; Size size; String pin; }
class LockerSlot {
String id; Size size; boolean free = true; Package cur;
boolean canHold(Size s) { return free && size.ordinal() >= s.ordinal(); }
}
class LockerBank {
List<LockerSlot> slots;
Map<String, LockerSlot> byPackage = new HashMap<>();
LockerSlot assign(Package p) {
for (LockerSlot s : slots) if (s.canHold(p.size)) {
s.free = false; s.cur = p; byPackage.put(p.id, s); return s;
}
return null; // full — say this out loud
}
Package pickup(String packageId, String pin) {
LockerSlot s = byPackage.get(packageId);
if (s == null || !s.cur.pin.equals(pin)) return null;
Package out = s.cur; s.cur = null; s.free = true; byPackage.remove(packageId);
return out;
}
}
If they add expiry or notifications: a scheduled sweep, not a second thread you cannot test in Live Code. If they add many sites: slot inventory per site id.
GFG fresher off-campus R2. Vehicle types, nearest spot, leave, full. Taanya “similar to parking with intervals/stream” is similar-to, not a second independent Parking Lot.
enum Type { MOTORCYCLE, CAR, BUS }
class Spot { Type type; boolean free = true; String vehicleId; }
class ParkingLot {
List<Spot> spots;
Map<String, Spot> parked = new HashMap<>();
boolean park(String vid, Type t) {
for (Spot s : spots) if (s.free && s.type == t) {
s.free = false; s.vehicleId = vid; parked.put(vid, s); return true;
}
return false;
}
int leave(String vid) {
Spot s = parked.remove(vid);
if (s == null) return -1;
s.free = true; s.vehicleId = null; return 0; // fee = time * rate if they add a clock
}
}
Aditya two-onsite + BR. Clarify: exact key vs prefix vs filter. Default: HashMap exact; prefix → Trie; top-K historical terms → Trie + heap of counts (bible also lists searchable-prefix top-K on a Cloudflare’d post — unnamed details stay unnamed).
class TrieNode {
TrieNode[] ch = new TrieNode[26];
int count;
}
class SearchTerms {
TrieNode root = new TrieNode();
void add(String w) {
TrieNode n = root;
for (char c : w.toCharArray()) {
int i = c - 'a';
if (n.ch[i] == null) n.ch[i] = new TrieNode();
n = n.ch[i];
}
n.count++;
}
boolean search(String w) {
TrieNode n = root;
for (char c : w.toCharArray()) {
int i = c - 'a';
if (n.ch[i] == null) return false;
n = n.ch[i];
}
return n.count > 0;
}
}
Shiwangi UTA named, mapped R3 in bible. HashMap word → count; maybe per-book maps then merge. This is DS plus a Book class, not a microservice.
Bhavya HM, not R2, not Login Tracker. Controller → Facade → Service → Repository. Sketch four classes and where validation lives. Do not invent JWT internals you did not ship in Java.
Independent SDE I live count = 1 (IE.in 2025-grad Second Technical, OA+3, not UTA two-DSA). If they still ask:
class TokenBucket {
final int cap; final double rate;
final Map<String, double[]> st = new HashMap<>(); // tokens, lastSec
TokenBucket(int cap, double rate) { this.cap = cap; this.rate = rate; }
synchronized boolean allow(String key) {
long now = System.nanoTime();
double[] b = st.get(key);
if (b == null) { b = new double[]{cap, now}; st.put(key, b); }
double tokens = Math.min(cap, b[0] + (now - b[1]) / 1e9 * rate);
if (tokens < 1) { b[0] = tokens; b[1] = now; return false; }
b[0] = tokens - 1; b[1] = now; return true;
}
}
Distributed: Redis + Lua so refill cannot race. Fail-open vs fail-closed is a spoken decision. Reject with 429 and Retry-After. Do not claim you shipped this at Ylogx.
Not first-hand. Same as LRU without capacity: HashMap + DLL, oldest at head, newLogin moves to tail, getOldest peeks.