Blog
Crack Coding Interview : 300+ Coding Problems For Practice
- August 24, 2023
- Posted by: InterviewExpert.org
- Category: Coding Problems
Welcome to the ultimate coding haven for aspiring developers and programmers who are preparing for their interview. In this article we have prepared a list of more that 300+ problems, that will help you to crack coding interview. Its basically a mixture of basic and intermediate problems. Some of are advanced level as well.
The below list is suitable for both the service based company interview preparation and product based company interview preparations. It will help you practice, refine your skills, and confidently crack those challenging interviews.
You are going to master yourself from the basics like while loops, for loops, and switch statements to diving deep into the data structures such as singly linked lists, doubly linked lists, and circular linked lists — this repository has got you covered.
Along with that we have also covered a rich array of problems focused on arrays, strings, searching and sorting algorithms. Each problem is designed to push your boundaries, providing the perfect platform to enhance your problem-solving and practice to boost your confidence in technical interviews.
Whether you’re preparing for a job interview, coding competition, or simply looking to strengthen your coding skills, this blog is your go-to resource. Each problem is accompanied by detailed explanations and sample solutions, ensuring that you not only understand the “how” but also the “why” behind each solution.
So, if you’re ready to embark on a coding interview preparation journey, lets dive into the world of 300+ coding problems. This collection will surely help you in coding interview preparations.
✔️ if Else Statement Based Program
✔️ Coding Questions on While Loop
✔️ Coding Programs on For Loop
| Programs | YouTube |
| 1. Print all natural numbers from 1 to n using for loop. | |
| 2. Program to print all even numbers between 1 to 100 using for loop. | |
| 3. Print all odd number between 1 to 100 using for loop. | |
| 4. Print sum of all even numbers between 1 to n using for loop. | |
| 5. Print sum of all odd numbers between 1 to n using for loop. | |
| 6. Program to print multiplication of any number using for loop. | |
| 7. Program to count the digits of a given number using for loop. | |
| 8. Program to print the sum of digits of a given number using for loop. | |
| 9. Program to print all natural numbers in reverse order using for loop. | |
| 10. Check whether a given number is Prime or not using for loop. | |
| 11. Print all Prime numbers between 1 to n using for loop. | |
| 12. Find sum of all prime numbers between 1 to n using for loop. | |
| 13. Check a given number is Armstrong or not using for loop. | |
| 14. Program to print all Armstrong numbers between 1 to n using for loop. | |
| 15. Program to check a given number is Perfect or not using for loop. | |
| 16. Print all Perfect numbers between 1 to n using for loop. | |
| 17. Check a given number is Strong number or not using for loop. | Video |
| 18. Print all Strong numbers between 1 to n using for loop. | Video |
| 19. Program to swap first and last digit of number using for loop. | Video |
| 20. Swap values using third variable using for loop. | |
| 21. Swap values without using third variable using for loop. | |
| 22. Calculate power of a number without using pow method using for loop. | |
| 23. Calculate power of a number with pow method using for loop. | |
| 24. Check number is palindrome or not using for loop. | |
| 25. Print Fibonacci series of a given number using for loop. | |
| 26. Print Fibonacci series of a given number using recursion using for loop. | |
| 27. Print the frequency of digits in given number using for loop. | |
| 28. Program to print ASCII character with values using for loop. | |
| 29. Program to print ASCII character with values using for loop. | |
| 30. Print all alphabets from a to z using for loop. | |
| 31. Print all uppercase alphabets using for loop. | |
| 32. Print all lowercase alphabets using for loop. | |
| 33. Print all factors of a number using for loop. | |
| 34. Print all factors of a number using for loop. | |
| 35. Print LCM of two numbers using for loop. | |
| 36. Find all prime factors of a number using for loop. |
✔️ Program on Switch Statement
| Programs | YouTube |
| 1. Program to print day name of given week using switch statement. | |
| 2. Program print total number of days in a given month using switch Statement. | |
| 3. Program to check a given alphabet is vowel or consonant using switch statement. | |
| 4. Program to check a given number is positive, negative or zero using switch statement. | |
| 5. Program to print maximum among two numbers using switch statement. | |
| 6. Program to check a given number is even or odd using switch statement. | |
| 7. Program to create Simple Calculator using switch statement. | |
| 8. Program to check whether a year is a leap year or not using switch statement. | |
| 9. Program to check a given triangle is an equilateral, isosceles or scalene triangle using switch statement. | |
| 10. Program to Convert positive number into negative and negative number into a positive using switch statement. |
✔️ Coding Questions based on String
| Programs | YouTube |
| 1. Print the length of given string. | |
| 2. Concatenate two strings. | |
| 3. Compare two strings. | |
| 4. Perform copy of one string to another string. | |
| 5. Convert lowercase string to uppercase. | |
| 6. Convert uppercase string to lowercase. | |
| 7. Reverse order of words in a given string. | |
| 8. Print the frequency of alphabets, digits or special character in a string. | |
| 9. Count total number of vowels and consonants in a string. | |
| 10. Count total number of words in a string. | |
| 11. Find reverse of a string. | |
| 12. Check whether a string is palindrome or not. | |
| 13. Print the first character in a given string. | |
| 14. Print the last character in a given string. | |
| 15. Print the frequency of each character in a string. | |
| 16. Find highest frequency character in a string. | |
| 17. Find lowest frequency character in a string. | Video |
| 18. Remove first character from string. | Video |
| 19. Remove last character from string. | |
| 20. Remove all vowels from string. | |
| 21. Remove all consonants from a given string. | |
| 22. Replace all space with * in a given string. | |
| 23. Remove line break from the string. |
✔️ Programs on Array
| Programs | YouTube |
| 1. Program to print all elements of an array. | |
| 2. Print the sum of elements in an array | |
| 3. Print the average of array elements | |
| 4. Print the largest element in an array. | |
| 5. Print the smallest element in an array | |
| 6. Reverse the elements of an array. | |
| 7. Determine if the given array is sorted in ascending or descending order. | |
| 8. Copy elements from one array to another. | |
| 9. Merge two arrays into a single array. | |
| 10. Identify and print duplicate elements in an array. | |
| 11. Remove duplicate elements from an array. | |
| 12. Identify and print the missing number in a given range. | |
| 13. Rotate array elements to the left by a given number of positions. | |
| 14. Rotate array elements to the right by a given number of positions. | |
| 15. Implement linear search to find the position of an element in an array. | |
| 16. Implement binary search in a sorted array. | |
| 17. Sort an array in ascending order. | Video |
| 18. Sort an array in descending order. | Video |
| 19. Count and print the occurrences of each element in an array. | |
| 20. Find and print the two elements whose sum is equal to given target sum. | |
| 21. Find and Print the intersection of two arrays | |
| 22. Find and print the union of two arrays. | |
| 23. Given an array of 0s and 1s, segregate them in linear time. | |
| 24. Print leader element in an array. | |
| 25. Print the majority element in an array. | |
| 26. Find and print the maximum product of a subarray in an array. | |
| 27. Print the amount of water that can be trapped between the bars. | |
| 28. Implement array rotation using the Juggling algorithm. | |
| 29. Find and print the maximum sum of a subarray using Kadane’s Algorithm. | |
| 30. Given arrival and departure times of trains, find the minimum number of platforms required. | |
| 31. Find and print the length of the longest increasing subsequence. | |
| 32. Write a Program to shift all zero at end of the array. |
✔️ Coding Problems on Matrix
| Programs | YouTube |
| 1. Program to print all elements of a matrix. | |
| 2. Add two matrices and print the result. | |
| 3. Subtract one matrix from another and print the result. | |
| 4. Multiply two matrices and print the result. | |
| 5. Print the transpose of a matrix. | |
| 6. Print the sum of each row and each column in a matrix. | |
| 7. Print the sum of the main diagonal elements of a matrix | |
| 8. Determine if a matrix is upper or lower triangular. | |
| 9. Print the saddle point in a matrix. | |
| 10. Represent a sparse matrix and perform addition on it. | |
| 11. Print the largest element in each row of a matrix. | |
| 12. Print the smallest element in each column of a matrix. | |
| 13. Multiply each element of a matrix by a constant. | |
| 14. Rotate the elements of a matrix by 90 degrees. | |
| 15. Determine if a given matrix is an identity matrix. | |
| 16. Interchange any two rows of a matrix. | |
| 17. Interchange any two columns of a matrix. | Video |
| 18. Add elements of a matrix in a zigzag manner. | Video |
| 19. Calculate and print the trace of a matrix. | |
| 20. Determine if a given matrix is sparse. | |
| 21. Multiply each element of a matrix by the sum of its column. | |
| 22. Print the elements of a matrix in spiral order. | |
| 23. Count and print the frequency of each element in a matrix. | |
| 24. Print the largest element in the diagonal of a matrix. | |
| 25. Print common elements present in each row of a matrix. | |
| 26. Print the sum of boundary elements in a matrix. | |
| 27. Sort the rows of a matrix in ascending order based on the first element. | |
| 28. Print the maximum element in each column of a matrix. | |
| 29. Print the sum of non-diagonal elements in a matrix. | |
| 30. Interchange the principal diagonals of a matrix. |
✔️ Coding Questions of Singly Linked List
| Programs | YouTube |
| 1. Program to create a singly linked list. | |
| 2. Print all elements of a singly linked list. | |
| 3. Find the length of a singly linked list. | |
| 4. Add a new node at the beginning of a linked list. | |
| 5. Add a new node at the end of a linked list. | |
| 6. Insert a new node at a specified position in a linked list. | |
| 7. Delete the first node from a linked list. | |
| 8. Delete the last node from a linked list. | |
| 9. Delete a node at a specified position in a linked list. | |
| 10. Search for a specific element in a linked list. | |
| 11. Find and print the middle element of a linked list. | |
| 12. Check if there is a loop in a linked list. | |
| 13. Remove the loop in a linked list, if present. | |
| 14. Reverse the elements of a linked list. | |
| 15. Merge two sorted linked lists into a single sorted linked list. | |
| 16. Remove duplicates from a sorted linked list. | |
| 17. Detect and remove a cycle in a linked list. | Video |
| 18. Check and print if a linked list is a palindrome. | Video |
| 19. Find the intersection point in Y-shaped linked lists. | |
| 20. Delete N nodes after every M nodes in a linked list. | |
| 21. Move the last node to the front of a linked list. | |
| 22. Rotate elements of a linked list by K positions. | |
| 23. Print the Nth node from the end of a linked list. | |
| 24. Pairwise swap elements of a linked list. | |
| 25. Split a linked list into two lists, where one contains alternate nodes. |
✔️ Coding Questions of Doubly Linked List
| Programs | YouTube |
| 1. Program to Implement a doubly linked list. | |
| 2. Reverse a doubly linked list. | |
| 3. Insert a node at the beginning of a doubly linked list. | |
| 4. Insert a node at the end of a doubly linked list. | |
| 5. Delete a node by value from a doubly linked list. | |
| 6. Delete a node at a given position from a doubly linked list. | |
| 7. Find the length of a doubly linked list. | |
| 8. Find the length of a doubly linked list. | |
| 9. Rotate a doubly linked list by N nodes. | |
| 10. Detect a cycle in a doubly linked list. | |
| 11. Find the intersection point of two doubly linked lists. | |
| 12. Merge two sorted doubly linked lists. | |
| 13. Partition a doubly linked list around a given value. | |
| 14. Check if a doubly linked list is a palindrome. | |
| 15. Implement LRU Cache using a doubly linked list. | |
| 16. Sort a doubly linked list using merge sort. | |
| 17. Find the kth node from the end in a doubly linked list. | Video |
| 18. Add two numbers represented by doubly linked lists. | Video |
| 19. Convert a binary search tree to a sorted doubly linked list. | |
| 20. Implement a stack using a doubly linked list. | |
| 21. Implement a queue using a doubly linked list. | |
| 22. Check if a doubly linked list is symmetric. | |
| 23. Find the middle element in a doubly linked list. |
✔️ Coding Questions of Circular Linked List
| Programs | YouTube |
| 1. Program to Implement a circular linked list. | |
| 2. Insert a node at the beginning of a circular linked list. | |
| 3. Insert a node at the end of a circular linked list. | |
| 4. Delete a node by value from a circular linked list. | |
| 5. Delete a node at a given position from a circular linked list. | |
| 6. Find the length of a circular linked list. | |
| 7. Split a circular linked list into two halves. | |
| 8. Check if a circular linked list has a loop. | |
| 9. Find the starting point of the loop in a circular linked list. | |
| 10. Insert a node in a sorted circular linked list. | |
| 11. Reverse a circular linked list. | |
| 12. Josephus Problem: Find the last remaining person in a circle of n people after skipping m-1 persons at a time. | |
| 13. Convert a binary tree to a circular doubly linked list. | |
| 14. Flatten a multilevel doubly linked list (DLL with child pointers). | |
| 15. Check if a circular linked list is a palindrome. | |
| 16. Implement a circular queue using a circular linked list. | |
| 17. Find the intersection point of two circular linked lists. | Video |
| 18. Rotate a circular linked list by N nodes. | Video |
| 19. Implement a stack using a circular linked list. | |
| 20. Implement a queue using a circular linked list. | |
| 21. Sort a circular linked list. | |
| 22. Find the middle element in a circular linked list. | |
| 23. Find the length of the loop in a circular linked list. | |
| 24. Delete the last occurrence of a given key in a circular linked list. |
✔️ Coding questions on Searching
| Programs | YouTube |
| 1. Implement linear search to find the position of an element in an array. | |
| 2. Implement linear search to find the position of an element in a linked list. | |
| 3. Implement binary search to find the position of an element in a sorted array. | |
| 4. Implement binary search to find a node in a Binary Search Tree (BST). | |
| 5. Implement interpolation search to find the position of an element in a sorted array. | |
| 6. Implement exponential search to find the position of an element in a sorted array. | |
| 7. Implement Fibonacci search to find the position of an element in a sorted array. | |
| 8. Given a matrix, search for an element efficiently in a row-wise and column-wise sorted matrix. | |
| 9. Implement jump search to find the position of an element in a sorted array. | |
| 10. Implement linear probing in a hash table for searching. | |
| 11. Implement binary search on a rotated sorted array. | |
| 12. Implement hashing with chaining for efficient search. | |
| 13. Given a sorted array, find the starting and ending position of a given target value. | |
| 14. Given a sorted array and a target value, return the index where the target should be inserted. | |
| 15. Search for a target value in a 2D matrix with rows and columns sorted in ascending order. | |
| 16. Given a bitonic array, find an element in it. | |
| 17. Search for an element in a sorted and rotated array. | Video |
✔️ Coding questions on Sorting
| Programs | YouTube |
| 1. Implement the bubble sort algorithm to sort an array. | |
| 2. Implement the selection sort algorithm to sort an array. | |
| 3. Implement the insertion sort algorithm to sort an array. | |
| 4. Implement the merge sort algorithm to sort an array. | |
| 5. Implement the quicksort algorithm to sort an array. | |
| 6. Implement the heap sort algorithm to sort an array. | |
| 7. Implement the counting sort algorithm for sorting integers. | |
| 8. Implement the radix sort algorithm for sorting integers. | |
| 9. Implement the bucket sort algorithm for sorting floating-point numbers. | |
| 10. Implement the shell sort algorithm to sort an array. | |
| 11. Implement the comb sort algorithm to sort an array. | |
| 12. Implement the pancake sort algorithm to sort an array. | |
| 13. Implement the cycle sort algorithm to sort an array. | |
| 14. Implement the BogoSort algorithm to sort an array. | |
| 15. Implement the gnome sort algorithm to sort an array. | |
| 16. Implement the cocktail shaker sort algorithm to sort an array. | |
| 17. Implement the odd-even sort algorithm to sort an array. | Video |
| 18. Implement the stooge sort algorithm to sort an array. | Video |
