# Top 100 Interview Programming questions, that asks many times

## here we discuss some PS/DS coding questions that mostly asked in interviews

Hello Folks, in a software development carrier when we want to start with a job. being selected for the first round of interviews requires some luck.no matter what stage of your career you are at, this applies.

However, it can be the most challenging at the beginner level when looking for your first job.

Especially computer science graduate and software developer community is inundated with applications for programming jobs at startups like Uber and Netflix, large companies such as Amazon, Microsoft, and Google, and service-based firms like Wipro.

However, most of them don’t know what kind of programming interview questions you can expect when applying to these companies.

As part of this article, I will share with you some frequently asked questions from different interviews with programmers with different levels of experience, from people just out of college to those with one or two years of experience.

In coding interviews, you will generally get asked questions on data structures and algorithms as well as a few logical ones. For example, how do you swap two integers without the use of a temporary variable?

It is recommended that you practice on paper at some point during your preparation. It takes you away from your comfort zone when you code without an IDE and Stack Overflow. Furthermore, it simulates a whiteboard interview realistically.

*Also, one more thing that wants to highlight is please understand the core concept of all algorithms and you must know the requirements of all data structure types before it started.*

So now let us see, all the major question that is mostly asked, firstly I cover 20 questions that are generally asked then in the other 4 categories we discuss specific topics like Array-List, string, etc.

as of now I only added those questions, but if you think any other questions are also needed, then add in a comment below.

So, firstly we cover some random questions many times Interviewer asks some general questions to know your knowledge, mainly they want to know if you can do that or not. so that’s the question that is generally asked, and these are bonus questions (I am not included those in the hundred)

So let’s start to see all the questions.

**There are usually random questions asked.**

- swiping Program

like a=50;

b=10;

output:- b=50, and a =10

Answer:*S*olution - short array without the use of a short function

input :-var a= [1,2,5,3,4,6,7,8];

output :-var a=[1,2,3,4,5,6,7,8];

Answer:*Solution* - get the second largest number of the array list.

input :- a= [1,2,5,3,4,6,7,8];

output :- 7;

Answer:*Solution* - write a program that generates 50 prime number

example of prime number is :- 2,3,5,7,9,11,13,17,19,23,29….Answer:*Solution* - reverse string without loop or predefined function(like reverse)

Like: var name =”shirsh”

after reverse: var name =”hsrihs”Answer:*Solution* - Create and Add a two matrix 2x2 or 3x3.
Answer:*Solution* - Count repeated items in a String.

Like: var name =” Shirsh”

so, “s”=2 times, “h”=2 times, “i”=1 time, “r”= 1 timeAnswer:*Solution* - how to check the name of the number in English?

For: if I assign any variable:- var num =**121**

so print this number in English letter, means on console print result is -:**“one hundred twenty-one”**Answer:*Solution* - How to get the matching characters and non-matching characters in a string.

Example:-*Input:**str1 = “abcdef”, str2 = “defghia”**Output:**4*Answer:

Matching characters are: a, d, e, f*Solution* - How to calculate the number of vowels and consonants in a string?

Answer:*Solution* - Determine the factors of a number.

Answer:*Solution* - Compute the first Ten Fibonacci numbers.

Answer:*Solution* - How to get the third node of a linked list?

Answer:*Solution* - How to search for a specific value in a linked list?

Answer:*Solution* - How to remove special characters in a string that is in lowercase?

Answer:*Solution* - How to find multiple missing numbers in a given integer array with duplicates?

Answer:*Solution* - How to find all permutations of String?

Answer:*Solution* - writes a program for Sudoku.
Answer:*Solution* - How to check if a given number is a Palindrome?

Answer:*Solution* - How to calculate the average of all numbers in a given array?

Answer:*Solution* - Write a Program to check if a given year is a leap year.

Answer:*Solution* - Write Program to check whether the number is Palindrome or not.

Answer:*Solution* - Write a Program to check whether the number is a Narcissistic number or not.

Answer:*Solution* - Write a Program to print all numbers of a list in a random manner and all numbers should be only one, without using any pre-defined function.

input :- a= [1,2,5,3,4,6,7,8,8,8,8,9,9,9];

output :- a = [2,4,9,7,1,3,6,5,8];

Answer: if you have Please comment below. - Find the Fastest way to find an index of elements in a list. (ex:-binary search)

input :- var list =[1,2,3,4,5,6,7,8,9,10,11,12,13,14];

var numFind =2;

output:- 1 Index

Answer:-*Solution* - Find the sum of all natural numbers without using any regression or any loop.

Answer:-*Solution* - Find the nearest smaller numbers on the left side in an array.

Answer:-*Solution* - Find the minimum number of coins that make a given value.

Input**:**V = 70

Output**:**2

We need a 50 Rs note and a 20 Rs note.

Answer:-*Solution* - Find the index of two array elements whose sum is equal to the given value

**Coding interview questions for arrays**

- How do remove duplicates from a given array?

(*solution**)* - How do you search for a target value in a rotated array?

(*solution**)* - How do you find the missing number in a given integer array of 1 to 100? (
*solution*) - How do you find the duplicate number on a given integer array?

(*solution*) - How do you find the largest and smallest number in an unsorted integer array?

(*solution*) - How do you find all pairs of an integer array whose sum is equal to a given number?

(*solution*) - How do you remove duplicates from an array in place?

(*solution*) - How to rotate an array left and right by a given number K?

(*solution*) - How do you find duplicates from an unsorted array?

(*solution*) - Given an array of integers sorted in ascending order, find the starting and ending position of a given value.

(*solution*) - Given an unsorted array of integers, find the length of the longest consecutive elements sequence.

(*solution*) - How is an integer array sorted in place using the quicksort algorithm? (
*solution*) - Given an integer array, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

(*solution*) - How do you reverse an array in place in Java?

(*solution*) - How are duplicates removed from an array without using any library? (
*solution*) - How to convert a byte array to a String?

(*solution*) - What is the difference between an array and a linked list?

(s*olution*) - How do you perform a binary search in a given array?

(*solution*) - How to find a median of two sorts of arrays?

(*solution*) - How do you find duplicate numbers in an array if it contains multiple duplicates?

(*solution*)

**Coding interview questions about linked lists**

- How do you reverse a linked list?

(*solution*) - How to add an element in the middle of the linked list?

(*solution*) - How to find the node at which the intersection of two singly linked lists begins.

(*solution*) - How to check if a given linked list is a palindrome or not?

(*solution*) - How do you find the middle element of a singly linked list in one pass? (
*solution*) - How do you check if a given linked list contains a cycle? How do you find the starting node of the cycle?

(*solution*) - How do you find the third node from the end in a singly linked list? (
*solution*) - How do you find the sum of two linked lists using Stack?

(*solution*) - How to Delete all occurrences of a given key in a linked list?

(*solution*) - How do you reverse a linked list?

(*solution*) - How do you sort a linked list in Java?

(*solution*) - What is the difference between the array and linked list?

(*Solution*) - How to remove Nth Node from the end of a linked list?

(*solution*) - How to merge two sorted linked lists?

(solution) - How to convert a sorted list to a binary search tree?

(*solution*) - Given a linked list and a value
*x*, partition it such that all nodes less than*x*come before nodes greater than or equal to*x*.

(*solution*) - How to remove duplicates from a sorted linked list?

(*solution*) - How do you reverse a singly linked list without recursion?

(*solution*) - How are duplicate nodes removed in an unsorted linked list?

(*solution*) - How do you find the length of a singly linked list?

(*solution*)

**Coding interview questions for strings**

- How do you reverse a given string in place?

(*solution*) - How do you print duplicate characters from a string?

(*solution*) - How do you check if two strings are anagrams of each other?

(*solution*) - How do you find all the permutations of a string?

(*solution*) - How can a given string be reversed using recursion?

(*solution*) - How do you check if a string contains only digits?

(*solution*) - How do you find duplicate characters in a given string?

(*solution*) - How do you count the number of vowels and consonants in a given string? (
*solution*) - How do you count the occurrence of a given character in a string? (
*solution*) - How do you print the first non-repeated character from a string?

(*solution*) - How do you convert a given String into int like the atoi()?

(*solution*) - How do you reverse words in a given sentence without using any library method?

(*solution*) - How do you check if two strings are a rotation of each other?

(solution) - How do you check if a given string is a palindrome?

(*solution*) - How to find the length of the longest substring without repeating characters?

(*solution*) - Given a string, find the maximum length contiguous substring of it that is also a palindrome. For example, the longest palindromic substring of “bananas” is “anana”, and the longest palindromic substring of “abdcbcdbdcbbc” is “bdcbcdb”.

(*solution*) - How to convert a byte array to a String?

(*solution*) - how do remove the duplicate character from String?

(*solution*) - How to find the maximum occurring character in a given String? (
*solution*) - How do you remove a given character from a String?

(*solution*)

**Coding interview questions for Binary Tree**

- How do you implement a postorder traversal algorithm?

(*solution*) - How do you traverse a binary tree in postorder traversal without recursion?

(*solution*) - How are all leaves of a binary search tree printed?

(*solution*) - How do you count the number of leaf nodes in a given binary tree? (
*solution*) - You have given a BST, where two nodes are swapped? How do you recover the original BST?

(*solution*) - How is a binary search tree implemented?

(*solution*) - How do you perform preorder traversal in a given binary tree?

(*solution*) - How do you traverse a given binary tree in preorder without recursion? (
*solution*) - How do you perform an inorder traversal in a given binary tree?

(*solution*) - How do you print all nodes of a given binary tree using inorder traversal without recursion?

(*solution*) - How do you convert a binary tree to a binary search tree?

(*solution*) - Find the largest BST subtree of a given binary tree.

(*solution*) - Write a program to connect nodes at the same level as a binary tree. (
*solution*) - What is a Trie data structure?

(*solution*) - How do you perform a binary search in a given array?

(*solution*) - How to Convert a given Binary Tree to a Doubly Linked List?

(*solution*) - Write a Program to Find the Maximum Depth or Height of a Tree.

(*solution*) - What is the difference between binary and binary search trees?

(*solution*) - What is a Self-Balancing Binary Search Trees?

(*solution*) - What is the AVL Tree?

(*solution*)

**Coding interview questions for Graph**

- Print Adjacency List for a Directed Graph.

(*solution*) - what is the Difference between BFS and DFS?

(*solution*) - Write a to Count all possible paths between two vertices.

(*solution*) - Find the minimum number of throws required to win a given Snakes and Ladders board game.

(*solution*) - Find a Word in a 2D Grid of characters.

(*solution*) - Find the Distance of the nearest cell having 1 in a binary matrix.

(*solution*) - Find the number of islands.

(*solution*) - Find a Mother Vertex in a Graph.

(*solution*) - Implement Dijkstra’s Algorithm

(*solution*) - Find the most similar path in a graph.

(*solution*) - Given a sorted dictionary of an alien language, find the order of characters.

(*solution*) - Check whether a given graph is Bipartite or not.

(*solution*) - Keys and Rooms question.

(*solution*) - question on Articulation Points (or Cut Vertices) in a Graph.

(*solution*) - Tarjan’s Algorithm to find Strongly Connected Components.

(*solution*) - How to find all bridges in a graph?

(*solution*) - what is Maximum Bipartite Matching?

(*solution*) - Find all possible worlds in a board of characters(Boggle)

(*solution*) - Given a matrix of ‘O’ and ‘X’, replace ‘O’ with ‘X’ if surrounded by ‘X’.

(*solution*) - find the Shortest path to reach one prime to another by changing a single digit at a time.

(*solution*)

*So that’s all the questions that I think it's enough for practice, main thing is you should understand the main logic when you solve this question.because if you are able to get its core concept, you can solve their similar question as well.I took it from many websites as some research if you find out any wrong info or miscorrected also if you think any major question that I missed to include in there, please write in the comment below.*