Barclays 26NG OA Ultimate Guide | Hard Mode Memory Manager Real Questions + Passing Tips
Source: Dev.to


OA Core Information at a Glance
- Platform: Codility
- Difficulty: Hard (higher than typical LeetCode questions)
- Key Focus Areas: Memory management, state maintenance, edge‑case handling, robust implementation
- Distinct Features: Long descriptions, many hidden edge cases (fragmentation, invalid ops, double free)
Exclusive Real Question Analysis (2 Core Problems)
1. Basic Memory Allocator
Requirement
Manage an N‑byte memory block and implement alloc supporting 1 / 4 / 8‑byte allocations. Return the starting index or -1 if no space is available.
Core Approach
# memory_status[i] = 0 → free, 1 → occupied
def alloc(size):
for i in range(N - size + 1):
if all(memory_status[j] == 0 for j in range(i, i + size)):
for j in range(i, i + size):
memory_status[j] = 1
return i
return -1
- Scan sequentially to find a continuous free segment of the required size.
- Mark the segment as occupied and return its start index.
- If none is found, return
-1.
Pitfall‑Avoidance Tip
Sequential scanning passes all performance tests. Do not over‑optimize. Focus on correct indexing, state consistency, and boundary checks.
2. Full Memory Manager (with free)
Requirement
Extend the allocator by adding a free(address) method. The address must be validated—invalid if:
- It was never allocated.
- It was already freed.
- It is not the starting address of a block.
Core Challenge
free only provides the starting address → you must record the allocated size.
Essential Data Structures
memory_statusarray (tracks each byte).allocation_recordsmap: key = starting index, value = allocated size.
Free Implementation Steps
def free(addr):
if addr not in allocation_records:
raise ValueError("Invalid free")
size = allocation_records[addr]
for i in range(addr, addr + size):
memory_status[i] = 0
del allocation_records[addr]
- Verify the address exists in
allocation_records. - Retrieve the size; mark
[addr, addr + size)as free. - Delete the entry from the map.
Hidden Test Focus
- Fragmentation handling
- Double‑free attempts
- Freeing an intermediate address (not the start)
- Freeing addresses outside the memory range
- Re‑allocation after fragmentation
Frequently Asked Questions (High‑Risk Traps)
Q1: Can sequential scan pass performance tests?
A: Yes. Codility emphasizes correctness over micro‑optimization. Sequential scan is safe and reliable.
Q2: Array or bitmap for tracking memory?
A: Use an array. A bitmap adds unnecessary complexity and bit‑manipulation overhead unless explicitly required.
Q3: Most common mistakes in free?
- Forgetting to store the allocated size → wrong release range.
- Not validating the start address.
- Double‑free operations.
- Freeing a non‑starting address inside a block.
Q4: Is special preparation necessary?
A: Absolutely. These system‑simulation tasks differ greatly from traditional algorithm problems. Without prior exposure, time pressure + edge cases = guaranteed mistakes.
OA Sprint Support — Ace Hard Mode Without Logical Failures
Barclays’ Codility OA is designed to expose logical weaknesses using tricky hidden tests. Even experienced candidates struggle with fragmentation handling and invalid‑operation detection.
ProgramHelp offers real‑time OA support through secure, undetectable online assistance. Senior FAANG‑level mentors guide you silently through:
- Low‑level simulation tasks (memory manager, CPU scheduling, file system simulation)
- Hard Codility edge‑case logic
- Resilient data‑structure design
- Error‑proof coding patterns
Stop guessing under time pressure—focus on getting the interview invite while the team helps you avoid elimination traps and confidently secure your 26NG offer ticket.