Job preparationProblem solving

Problem-solving and logical interview questions

12 questions · 6 min read

Arrays, linked lists, trees, graphs and design patterns — the questions that test how you think.

On these, showing how you think matters more than arriving at the answer.

So do not solve it in your head. Talk it through. The board wants the steps, not just the final line.

The questions

How would you invert a two-dimensional array? Explain with an example.

What to coverThis tests your data manipulation and your algorithmic thinking.

What is the most efficient way to merge and sort two sorted arrays?

What to coverThis judges your grasp of memory management and of efficient algorithms.

How would you determine the best, worst and average case complexity when analysing a program?

What to coverThis tests your analytical ability and your understanding of algorithmic complexity.

Design an algorithm to detect a cycle in a linked list.

What to coverThis tests your grasp of data structures and of sequential data processing.

How would you reverse every character in a string? Explain with an example.

What to coverThis tests string manipulation and general programming skill.

What is the singleton pattern and how would you implement it?

What to coverThis judges your understanding of design patterns and software architecture.

How do you perform an in-order traversal of a binary tree, and what is it used for?

What to coverThis tests your understanding of data structures and tree algorithms.

What algorithm finds the minimum spanning tree of a graph?

What to coverThis tests graph theory and your ability to solve optimisation problems.

Explain one method of detecting deadlock, and how you would prevent it.

What to coverThis judges your understanding of operating systems and of system resource management.

Implement a queue using a stack.

What to coverThis tests your knowledge of data structures and of more advanced programming technique.

What steps would you take to solve a particular programming problem?

What to coverGive it as steps, because the steps are what the board wants: first I restate the question in my own words to confirm it; then I settle the inputs, outputs and edge cases (empty input, a single element, very large input); I work a small example by hand; I write the straightforward solution; then I state the time and space complexity and where it could be improved; and finally I check it against the example.

How would you design a scalable and secure web application?

What to coverAnswer in two halves. Scale: a stateless application so you can add servers, a load balancer, database indexes and read replicas, caching for frequently requested data, a CDN for images and files, and heavy work pushed to a background queue. Security: HTTPS everywhere, hashed passwords, input validation and parameterised queries (against SQL injection), escaped output (against XSS), role-based permissions, rate limiting, and secrets kept in the environment rather than in the code.

Tips for this round

  • Before you start, restate the question in your own words — a perfect answer to the wrong question is worth nothing.
  • Give the simple solution first, then say how you would speed it up. Boards like that order.
  • Raise the edge cases yourself: empty input, a single element, very large input.

Want to learn this hands-on? Take a look at the related course.

Browse courses