Coding Interview Questions — Day 2 (with Python Solutions)
Introduction
Welcome back to Day 2 of the Coding Interview Challenge Series!
In this post, we’ll continue sharpening your coding skills with 15 new coding questions that test logic, data structures, and problem-solving speed.
Top 15 Coding Interview Questions (Day 2)
Question 1: Check for Prime Number
def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True
Question 2: Find Factorial of a Number (Recursive)
def factorial(n):
    return 1 if n == 0 else n * factorial(n - 1)
Question 3: Check for Palindrome String
def is_palindrome(s):
    return s == s[::-1]
Question 4: Find Maximum Element in a List
def find_max(lst):
    max_val = lst[0]
    for num in lst:
        if num > max_val:
            max_val = num
    return max_val
Question 5: Count Vowels in a String
def count_vowels(s):
    vowels = "aeiouAEIOU"
    return sum(1 for ch in s if ch in vowels)
Question 6: Find Second Largest Element
def second_largest(lst):
    unique = list(set(lst))
    unique.sort()
    return unique[-2]
Question 7: Reverse Words in a Sentence
def reverse_words(sentence):
    return ' '.join(sentence.split()[::-1])
Question 8: Find Missing Number in Sequence
def missing_number(nums):
    n = len(nums) + 1
    total = n * (n + 1) // 2
    return total - sum(nums)
Question 9: Check for Armstrong Number
def is_armstrong(n):
    digits = str(n)
    power = len(digits)
    return n == sum(int(d)**power for d in digits)
Question 10: Remove Duplicates from a List
def remove_duplicates(lst):
    return list(set(lst))
Question 11: Find Intersection of Two Lists
def list_intersection(a, b):
    return list(set(a) & set(b))
Question 12: Count Frequency of Elements in a List
def frequency_count(lst):
    freq = {}
    for item in lst:
        freq[item] = freq.get(item, 0) + 1
    return freq
Question 13: Sum of Digits of a Number
def sum_of_digits(n):
    return sum(int(d) for d in str(n))
Question 14: Check Anagram Strings
def is_anagram(s1, s2):
    return sorted(s1) == sorted(s2)
Question 15: Find Common Elements in Three Lists
def common_elements(a, b, c):
    return list(set(a) & set(b) & set(c))
Summary
You’ve now completed Day 2 of the Coding Interview Challenge series!
 * Covered 15 must-practice problems
 * Strengthened logic and pattern recognition
 * Built confidence with hands-on Python solutions
Keep practicing daily...
.png)
Comments
Post a Comment