Autocoder

Dell Coding Round Questions with Solutions

Last updated 2026-11-19

Third-party reports describe the Dell online test as computer-fundamentals multiple-choice questions plus about two easy-to-medium coding problems. That suggests practising clean solutions to standard array, string and number problems, not exotic algorithms. This page gives twelve such practice problems with complete runnable solutions, their complexity and the common mistake.

They are practice problems in the style the round is commonly reported to use, not real papers. For the process, read Dell hiring, and for strategy see how to crack a DSA coding round.

How to approach them

With about two coding questions in a limited time, accuracy beats cleverness. Read the constraints, write the simplest correct solution, run it mentally on a tiny input and the empty input, and only then optimise if the constraints demand it.

Practise on the platform style: reading input and printing exactly the expected format is where fresh candidates lose marks.

Hiring status

Reported test details come from third-party guides, not Dell. For sourced hiring facts, see Dell hiring, and use Dell's own careers site, jobs.dell.com, for current openings.

Dell Coding Round Questions with Solutions: questions with worked answers

  1. 1

    Find two numbers in an array that add up to a target.

    easy

    Store each value's index in a dictionary as you scan; for each number, check whether target - number is already there. For [2, 7, 11, 15] and target 9 the indices are 0 and 1. Time O(n), space O(n); the brute force pair loop is O(n squared). Common mistake: using the same element twice, which the check-before-insert order prevents.

    python
    def two_sum(a, target):
        seen = {}
        for i, x in enumerate(a):
            if target - x in seen:
                return seen[target - x], i
            seen[x] = i
        return None
    
    print(two_sum([2, 7, 11, 15], 9), two_sum([3, 3], 6), two_sum([1, 2], 7))  # (0, 1) (0, 1) None
  2. 2

    Move all zeros to the end of an array while keeping the order of the other elements, in place.

    easy

    Keep a write index for the next non-zero position; copy each non-zero value to it and advance, then fill the rest with zeros. [0, 1, 0, 3, 12] becomes [1, 3, 12, 0, 0]. Time O(n), space O(1). Common mistake: removing and appending in a loop, which is O(n squared) for lists.

    python
    def move_zeros(a):
        w = 0
        for x in a:
            if x != 0:
                a[w] = x
                w += 1
        for i in range(w, len(a)):
            a[i] = 0
        return a
    
    print(move_zeros([0, 1, 0, 3, 12]))  # [1, 3, 12, 0, 0]
  3. 3

    Check whether a string is a valid palindrome number or word, then count vowels.

    easy

    Compare the string with its reverse for the palindrome test, and count characters in "aeiou" after lowercasing. "Level" is a palindrome with 2 vowels; "dell" is not, with 1 vowel. Time O(n), space O(n) for the reversed copy. Common mistake: forgetting case, so "Level" fails the equality test.

    python
    def check(s):
        t = s.lower()
        return t == t[::-1], sum(ch in "aeiou" for ch in t)
    
    print(check("Level"), check("dell"))  # (True, 2) (False, 1)
  4. 4

    Compute the GCD and LCM of two numbers.

    easy

    Euclid's algorithm: gcd(a, b) = gcd(b, a mod b) until b is 0. Then lcm = a / gcd x b, dividing first to avoid overflow. For 12 and 18 the GCD is 6 and the LCM is 36. Time O(log min(a, b)), space O(1). Common mistake: computing a x b / gcd, which can overflow a 32-bit int before the division.

    c
    #include <stdio.h>
    long gcd(long a, long b) { while (b) { long t = a % b; a = b; b = t; } return a; }
    int main(void) {
        long g = gcd(12, 18);
        printf("%ld %ld\n", g, 12 / g * 18); /* 6 36 */
        return 0;
    }
  5. 5

    List all primes up to n with the Sieve of Eratosthenes.

    medium

    Mark every multiple of each prime starting from its square as composite. For n = 30 the primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. Time O(n log log n), space O(n). Common mistake: starting the inner loop at 2 x p instead of p x p, which still works but does extra work, or looping p up to n instead of the square root.

    python
    def primes(n):
        is_p = [True] * (n + 1)
        is_p[0:2] = [False, False]
        for p in range(2, int(n ** 0.5) + 1):
            if is_p[p]:
                for m in range(p * p, n + 1, p):
                    is_p[m] = False
        return [i for i, v in enumerate(is_p) if v]
    
    print(primes(30))  # [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
  6. 6

    Compute the n-th Fibonacci number efficiently.

    easy

    The naive recursion is exponential, O(2^n). Iterating with two variables is O(n) time and O(1) space. With F(0) = 0 and F(1) = 1, F(10) is 55 and F(50) is 12586269025. Use a 64-bit type in C beyond F(46). Common mistake: recomputing subproblems recursively without memoisation, which times out for n around 40.

    python
    def fib(n):
        a, b = 0, 1
        for _ in range(n):
            a, b = b, a + b
        return a
    
    print(fib(10), fib(50))  # 55 12586269025
  7. 7

    Binary search for a target in a sorted array, then count its occurrences.

    medium

    Use lower-bound and upper-bound searches: the count is the index after the last occurrence minus the index of the first. For [1, 2, 2, 2, 3, 5] and target 2, the count is 3. Time O(log n), space O(1). Common mistake: a linear scan after finding one match, which becomes O(n) when many duplicates exist.

    python
    from bisect import bisect_left, bisect_right
    
    def count(a, t):
        return bisect_right(a, t) - bisect_left(a, t)
    
    print(count([1, 2, 2, 2, 3, 5], 2), count([1, 2, 2, 2, 3, 5], 4))  # 3 0
  8. 8

    Reverse an integer, handling negative numbers.

    easy

    Work on the absolute value, peel digits with % 10 and rebuild with x 10, then restore the sign. 123 becomes 321 and -450 becomes -54. Time O(digits), space O(1). In a fixed-width language, check for overflow of the reversed value. Common mistake: using a string reverse on a negative number, which puts the minus sign at the end.

    python
    def reverse_int(n):
        sign = -1 if n < 0 else 1
        n, r = abs(n), 0
        while n:
            r = r * 10 + n % 10
            n //= 10
        return sign * r
    
    print(reverse_int(123), reverse_int(-450))  # 321 -54
  9. 9

    Check whether brackets in an expression are balanced.

    medium

    Push opening brackets on a stack; on each closing bracket, the top must be the matching opener. The expression is balanced if the stack is empty at the end. "(a[b]{c})" is balanced; "(]" and "((" are not. Time O(n), space O(n). Common mistake: popping from an empty stack on an extra closing bracket.

    python
    def balanced(s):
        pair = {')': '(', ']': '[', '}': '{'}
        st = []
        for ch in s:
            if ch in '([{':
                st.append(ch)
            elif ch in pair:
                if not st or st.pop() != pair[ch]:
                    return False
        return not st
    
    print(balanced("(a[b]{c})"), balanced("(]"), balanced("(("))  # True False False
  10. 10

    Find the maximum profit from one buy and one sell in a list of daily prices.

    medium

    Scan once, tracking the lowest price so far and the best profit if you sold today. For [7, 1, 5, 3, 6, 4] the answer is 5 (buy at 1, sell at 6); for a falling list it is 0. Time O(n), space O(1). Common mistake: taking the global minimum and global maximum, which may have the maximum before the minimum.

    python
    def max_profit(p):
        low, best = float('inf'), 0
        for x in p:
            low = min(low, x)
            best = max(best, x - low)
        return best
    
    print(max_profit([7, 1, 5, 3, 6, 4]), max_profit([7, 6, 4, 3, 1]))  # 5 0
  11. 11

    Remove duplicates from a sorted array in place and return the new length.

    easy

    Keep a write index to the last unique value. For each element, if it differs from the last unique one, write it at the next slot. [1, 1, 2, 2, 3] gives length 3 with the array starting [1, 2, 3]. Time O(n), space O(1). Common mistake: forgetting the sort precondition; for unsorted data use a set, which costs O(n) space.

    python
    def dedup(a):
        if not a:
            return 0
        w = 1
        for i in range(1, len(a)):
            if a[i] != a[w - 1]:
                a[w] = a[i]
                w += 1
        return w
    
    arr = [1, 1, 2, 2, 3]
    n = dedup(arr)
    print(n, arr[:n])  # 3 [1, 2, 3]
  12. 12

    Count the frequency of each word in a sentence and print the most common one.

    medium

    Split on whitespace, lowercase, and count with a dictionary; the most common word is the one with the highest count, with ties broken by first appearance or alphabetically as the question specifies. For "the cat and the hat and the bat" the answer is the, with 3. Time O(n), space O(k) for k distinct words. Common mistake: ignoring case and punctuation, so "The" and "the" count separately.

    python
    from collections import Counter
    
    def top_word(s):
        cnt = Counter(s.lower().split())
        return max(cnt.items(), key=lambda kv: kv[1])
    
    print(top_word("the cat and the hat and the bat"))  # ('the', 3)

Frequently asked questions

How many coding questions are in the Dell online test?

Third-party reports describe about two easy-to-medium coding questions alongside computer-fundamentals MCQs. This is not an official statement, and it can change from cycle to cycle.

Which language should I use?

Use the one you can write fastest and most accurately among those the platform offers. C, C++, Java and Python are the usual options; check your invitation.

Are these real Dell problems?

No. They are practice problems in the style the round is commonly reported to use. Dell does not publish its papers.

What if I get stuck in a coding question?

Write the brute-force solution, make it pass the sample, and then improve it if time remains. A working simple solution scores better than a half-written clever one.

Sources

Related guides

More in Company Interview Questions

See all in this section