Skip to main content

Campus placement coding round: question patterns and how to prepare

9 min readUpdated

Most campus placement and graduate hiring processes start with an online coding round: two or three problems in 60 to 90 minutes, checked against hidden test cases. The same patterns appear again and again. This guide lists them, solves two typical questions in Python and gives a six-week plan.

How the coding round usually works

  • Two to three problems, usually one easy, one medium and sometimes one harder.
  • Your code is run on hidden test cases; partial marks often depend on how many pass.
  • Input and output follow a fixed format, so read it carefully and print exactly what is asked.
  • Some rounds add multiple-choice questions on aptitude, output prediction and core subjects such as DBMS, operating systems and networks.

Patterns that repeat

PatternTypical question
Arrays and hashingFind pairs with a given sum, first repeated element, frequency counts
StringsPalindromes, anagrams, compress repeated characters, count vowels
Two pointers and sliding windowLongest substring without repeats, maximum sum of k consecutive items
Sorting and greedyMinimum platforms, meeting rooms, maximum items within a budget
MathPrime checks, GCD, digit sums, number patterns
StacksBalanced brackets, next greater element
Basic dynamic programmingClimbing stairs, coin change, longest increasing subsequence

Example 1: pair with a target sum

Return the first pair of positions that add up to target, using a dictionarypython
def pair_with_sum(nums, target):
    seen = {}
    for i, value in enumerate(nums):
        if target - value in seen:
            return seen[target - value], i
        seen[value] = i
    return -1, -1

print(pair_with_sum([2, 7, 11, 15], 9))
print(pair_with_sum([1, 2, 3], 10))

Example 2: compress a string

aaabccdd becomes a3b1c2d2python
def compress(text):
    if not text:
        return ""
    result = []
    count = 1
    for i in range(1, len(text)):
        if text[i] == text[i - 1]:
            count += 1
        else:
            result.append(text[i - 1] + str(count))
            count = 1
    result.append(text[-1] + str(count))
    return "".join(result)

print(compress("aaabccdd"))

A six-week plan

WeekFocus
1Arrays, strings and hashing: 3 problems a day
2Two pointers, sliding window and sorting
3Stacks, queues and recursion
4Basic dynamic programming and greedy
5Core subjects: DBMS and SQL, operating systems, networks
6Timed mock coding rounds, aptitude practice and HR preparation

Tips for the day

  • Solve the easiest problem first to secure marks.
  • Write a simple correct solution before optimising.
  • Test the edge cases: empty input, one element, all equal, very large values.
  • Print output in exactly the required format; extra spaces or text can fail every test case.

Frequently asked questions

Which language is best for placement coding rounds?

Any language you know well. Python is quick to write; Java and C++ are also accepted almost everywhere. Speed and correctness matter more than the language.

How many problems should I solve before placements?

Around 150 well-chosen problems that cover every common pattern is a strong target. Understanding each pattern matters more than the total.

Do placement tests include core computer science subjects?

Often yes: DBMS and SQL, operating systems, computer networks and object-oriented programming appear in multiple-choice sections and technical interviews.

More interview questions by topic

Practise this, step by step

Short lessons with quizzes, practice and interview questions, from your first program to job-ready.

Python Programming course: syllabus and 1:1 mentoringCore Python from zero to functions, collections, files, OOP and algorithms.