Barclays Online Assessment Hard Mode OA Successful AC! ProgramHelp takes students through the process!

114 Views
No Comment

Congratulations to ProgramHelp students on the latest round of the Barclays online assessment received a perfect score of AC!

Barclays OA has always been known for its "dissuasive difficulty", deployed on the Codility platform, with long topic descriptions, many boundary cases, and exceptionally tricky test cases. This time, students encountered even harder difficulty, completely bottom-level thinking simulation questions, need to implement a simplified "memory manager". These questions are completely different from ordinary LeetCode algorithm questions, and even skilled engineers can easily step into the pit.

Under the systematic guidance of ProgramHelp, the trainee successfully avoided all the invisible traps and had one AC. the following is the complete review of this OA.

Barclays Online Assessment Overview

Company: Barclays
Platform: Codility
Difficulty: Hard
Core Exams: Memory management, state maintenance, simulation system components, boundary condition handling, robust code implementation

You should never come up and write code for these types of system simulation questions. Only by designing the data structures first, and then writing the logic, can you pass under the stressful environment of Codility.

Barclays Online Assessment Exclusive Question Sharing

Basic Memory Allocator (BMA)

Design a basic memory allocator to manage a memory block of size N bytes.
Implement an alloc method that allocates continuous memory of size 1, 4, or 8 bytes.
Return the starting index of the allocated block, or -1 if no suitable space exists.

Analyze the ideas

The first question is a warm-up, focusing on simulating "finding continuous free space". Core methodology:

  1. Initialize the state array
    Use an array memory_status of length N, where 0 is free and 1 is occupied.
  2. Allocation logic (alloc)
    • Sequentially scans the array for contiguous free intervals of length size.
    • Once found, change the interval to occupied in its entirety
    • Returns the starting index, otherwise -1

This linear scanning plain write-up passes all test points perfectly.

ProgramHelp Points

Codility's hidden test measures "fragmentation", and handwritten continuous interval searches are the most reliable.
Higher-order writes can use a chained list of free intervals or a BitMap, but it is not necessary.
The key is that the code must be robust, state-consistent, and free of out-of-bounds risks.

Full Memory Manager with Free

Extend the previous allocator to support.

  • alloc(size): allocate 1, 4, or 8 bytes
  • free(address): free the block previously allocated at 'address'

You must ensure the address is valid, has not been freed.
and corresponds to the start of an allocated block.

Analyze the ideas

The difficulty of the second question escalated significantly, with the addition of free making it completely undoable if the data structure was not properly designed.

Key pain point: free(address) only tells you the starting address, but not how many bytes to free.

You must record "metadata" at alloc.

Data structure design (central to solving the whole problem)

  1. memory_status array
    Continue to keep track of whether each byte is occupied.
  2. allocation_records hash table (essential)
    • key: assign the starting address
    • value: size of allocated space (1/4/8)

A record is written at the time of allocation, and the scope of release is judged based on this record at the time of release.

The correct implementation of free(address)

  1. Check if address exists in allocation_records
    • If not present: illegal address, duplicate release or intermediate address, return error directly
  2. If present:
    • Find out size = allocation_records[address]
    • Restore memory_status[address ~ address+size) to free.
    • Delete this record from allocation_records

ProgramHelp Points

Codility's hidden tests specifically attack the following situations:

  • free Unallocated address
  • free Released address
  • free to the middle of the interval.
  • alloc chunks before releasing them to cause fragmentation, to test if alloc can still find chunks properly

If you only wrote the minimum feasible code for the first question, but did not design the record structure, you will not be able to write this question.

FAQ|Barclays Codility OA Frequently Asked Questions

Q1: How difficult is Barclays' Codility OA? Do I need to prepare in advance?
A: The difficulty is generally higher than regular LeetCode algorithmic questions, and especially likes to test engineering simulations, system component design (e.g. memory management, task scheduling, resource allocation, etc.). It is essential to prepare in advance, otherwise the time pressure and boundary situations can easily overwhelm people.

Q2: Will Codility jam performance? Can linear scanning pass?
A: For the most part Codility's time requirements are not extreme, but the hidden tests verify fragmentation, boundary legitimacy, duplicate operations, and so on. Linear scans usually pass, but watch out for code stability and out-of-bounds checks.

Q3:How to avoid the problem of not finding the size when free in the memory management class?
A: The metadata "Start address → Allocation size" must be recorded at alloc.
The most common way to do this is to use a HashMap / Dictionary, without which it is almost impossible to get the second question right.

Q4: What are the illegal cases of free(address)? Why is it easy to hang?
A: Codility will focus its attacks on the following scenarios:

  • Releasing an address that has never been assigned
  • Repeated release of the same address
  • Release a byte in the middle of the interval
  • Post-allocation fragmentation leads to misalignment of the next alloc

Without rigorous record structure and boundary checking, the code has a high probability of crashing or returning an error.

Q5: Is it better to use bitmap or array to record the state?
A: For Codility, both can pass.

  • Arrays are simple and straightforward, making it easy to write stable code
  • Bitmaps are more space efficient, but require additional bit operations

Unless the topic specifically emphasizes space optimization, the array scheme is more stable.

Break the spell of first round elimination and secure your interview ticket!

Facing the Online Assessment which is getting more and more tricky and the question bank is so deep that you can't see the bottom of it, have you experienced the despair of being stuck by the cold Hard questions or worrying about the lack of time and missing the opportunity? Don't let OA become the first hurdle you can't cross on your job search.

ProgramHelp re-launched OA without traces of online help services. We use the industry's leading security connection technology, the whole silent operation, in no way interfere with your normal operation under the premise of perfect avoidance of all kinds of mainstream OA platform detection mechanism. A team of senior factory mentors are online in real time to act as your "strongest behind-the-scenes brain". Whether it's Codility's underlying simulation questions, HackerRank's hidden questions, or CodeSignal's high-pressure speed pass requirements, we can take you through with the most robust code and ideas.

Don't face the unknown alone, leave the stress and risk to us, all you need to do is adjust and get ready for your Next Round interview call!Contact Us Nowlock in your exclusive assist slots so that OA is no longer a roadblock!

author avatar
jor jor
END
 0