Software Developer Intern
1000+ Software Developer Intern Interview Questions and Answers
Q1. Sum of Maximum and Minimum Elements Problem Statement
Given an array ARR
of size N
, your objective is to determine the sum of the largest and smallest elements within the array.
Follow Up:
Can you achieve the a...read more
Q2. Sliding Maximum Problem Statement
Given an array of integers ARR
of length 'N' and a positive integer 'K', find the maximum elements for each contiguous subarray of size K.
Example:
Input:
ARR = [3, 4, -1, 1, 5...read more
Software Developer Intern Interview Questions and Answers for Freshers
Q3. Find K Closest Elements
Given a sorted array 'A' of length 'N', and two integers 'K' and 'X', your task is to find 'K' integers from the array closest to 'X'. If two integers are at the same distance, prefer th...read more
Q4. Minimum and Maximum Candy Cost Problem
Ram is in Ninjaland, visiting a unique candy store offering 'N' candies each with different costs. The store has a special offer: for every candy you purchase, you can tak...read more
Q5. Nth Element Of Modified Fibonacci Series
Given two integers X
and Y
as the first two numbers of a series, and an integer N
, determine the Nth element of the series following the Fibonacci rule: f(x) = f(x - 1) ...read more
Q6. Fibonacci Membership Check
Given an integer N
, determine if it is a member of the Fibonacci series. Return true
if the number is a member of the Fibonacci series, otherwise return false
.
Fibonacci Series Defini...read more
Share interview questions and help millions of jobseekers 🌟
Q7. Hotel Room Booking Problem
You are managing a hotel with 10 floors numbered from 0 to 9. Each floor contains 26 rooms labeled from A to Z. You will receive a sequence of strings representing room bookings where...read more
Q8. Recycling Pens Problem Statement
Imagine you have a certain number of empty pens, and some money in your pocket. For each pen, you can choose to either recycle it for a reward or buy a refill to make it usable ...read more
Software Developer Intern Jobs
Q9. Fish Eater Problem Statement
In a river where water flows from left to right, there is a sequence of 'N' fishes each having different sizes and speeds. The sizes of these fishes are provided in an array called ...read more
Q10. Longest Palindromic Substring Problem Statement
You are provided with a string STR
of length N
. The goal is to identify the longest palindromic substring within this string. In cases where multiple palindromic ...read more
Q11. Reverse Words in a String: Problem Statement
You are given a string of length N
. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more
Q12. Kevin and his Fruits Problem Statement
Kevin has 'N' buckets, each consisting of a certain number of fruits. Kevin wants to eat at least 'M' fruits. He is looking to set a marker as high as possible such that i...read more
Q13. Longest Consecutive Sequence Problem Statement
You are provided with an unsorted array/list ARR
of N
integers. Your task is to determine the length of the longest consecutive sequence present in the array.
Expl...read more
Q14. Sum of Minimum and Maximum Elements of All Subarrays of Size K
You are provided with an array containing N integers along with an integer K. Your task is to compute the total sum of the minimum and maximum elem...read more
Q15. Replace Node With Depth Problem Statement
For a given Binary Tree of integers, replace each of its data with the depth of the tree. The root is at depth 0, hence the root data is updated with 0. Replicate the s...read more
Q16. Valid String Problem Statement
Given a string S
consisting solely of the characters '('
, ')'
, and '*'
, determine if it is a valid string.
Definition of Valid String:
1. Every left parenthesis '(' must have a co...read more
Q17. XOR Query Problem Statement
Assume you initially have an empty array called ARR
. You are required to return the updated array after executing Q
number of queries on this array.
There are two types of queries to...read more
The problem requires updating an array based on a series of queries, where each query can either insert a value or perform a bitwise XOR operation on all elements.
Use a loop to iterate through each query and update the array accordingly
For type 1 query, append the value to the end of the array
For type 2 query, perform a bitwise XOR operation on each element of the array with the given value
Return the updated array after processing all the queries
Q18. Jump Game Problem Statement
In this problem, you are given an array ARR
consisting of N
integers. Your task is to determine the minimum number of jumps required to reach the last index of the array N - 1
. At an...read more
Q19. Ninja and His Meetings Problem Statement
Ninja has started a new startup with a single conference room available for meetings. Given an array/list MEETINGS
of consecutive appointment requests, Ninja must decide...read more
Q20. K-th Permutation Sequence of First N Natural Numbers
Determine the K-th permutation from a sequence of the first N natural numbers.
Input:
Integer T indicating the number of test cases followed by 'T' test case...read more
The task is to find the Kth permutation of the sequence of first N natural numbers.
Generate all possible permutations of the sequence of first N natural numbers
Sort the permutations in lexicographical order
Return the Kth permutation from the sorted list
Q21. Kth Smallest and Largest Element Problem Statement
You are provided with an array 'Arr' containing 'N' distinct integers and a positive integer 'K'. Your task is to find the Kth smallest and Kth largest element...read more
Q22. First Missing Positive Problem Statement
You are provided with an integer array ARR
of length 'N'. Your objective is to determine the first missing positive integer using linear time and constant space. This me...read more
The task is to find the lowest positive integer that does not exist in the given array of integers.
Iterate through the array and mark the positive integers as visited using the array indices.
Iterate through the marked array and return the index of the first unmarked element.
If all positive integers are marked, return the length of the array + 1 as the missing positive integer.
Q23. Longest Substring Without Repeating Characters Problem Statement
Given a string S
of length L
, determine the length of the longest substring that contains no repeating characters.
Example:
Input:
"abacb"
Output...read more
Q24. Count Distinct Bitwise OR of All Subarrays
Given an array of positive integers, determine the number of distinct values obtained by applying the bitwise OR operation on all possible subarrays.
Explanation:
A su...read more
Q25. Ninja And The Fence Problem Statement
Ninja is given a task of painting a fence with ‘N’ posts using ‘K’ different colors. The task requires that not more than two adjacent posts have the same color. Your goal ...read more
Q26. Number of Islands Problem Statement
You are provided with a 2-dimensional matrix having N
rows and M
columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in this ma...read more
Q27. Remove Consecutive Duplicates Problem Statement
For a given string str
, remove all the consecutive duplicate characters.
Example:
Input:
Input String: "aaaa"
Output:
Expected Output: "a"
Input:
Input String: "a...read more
Q28. Sum of LCM Problem Statement
Given an integer 'N', calculate and print the sum of the least common multiples (LCM) for each integer from 1 to N with N.
The sum is represented as:LCM(1, N) + LCM(2, N) + ... + LC...read more
Q29. Unique Frequency Problem Statement
Given a string 'STR' with lowercase letters, determine the minimum number of deletions required to ensure that every letter in the string appears a unique number of times.
Exa...read more
Q30. LFU Cache Design Problem
Design and implement a Least Frequently Used (LFU) Cache with the following functionalities:
1. put(U__ID, value): Insert the value in the cache if the key ('U__ID') is not already pres...read more
Q31. Find the Minimum Cost to Reach Destination via Train
Given 'N' stations on a train route, where the train travels from station 0 to 'N'-1, determine the minimum cost to reach the final station using given ticke...read more
Q32. Minimum Operations to Connect a Graph
You are given a graph with 'N' vertices labeled from 1 to 'N' and 'M' edges. In one operation, you can shift an edge from being between two directly connected vertices to b...read more
Q33. Minimum Time To Solve The Problems
Given 'N' subjects, each containing a certain number of problems, and 'K' friends, assign subjects to friends such that each subject goes to exactly one friend, maintaining co...read more
Q34. 0-1 Knapsack Problem
A thief is planning to rob a store and has a knapsack that can carry a maximal weight of W
. There are N
items available, where each item i
has a weight wi
and a value vi
. Determine the maxi...read more
Q35. Container with Most Water Problem Statement
Given a sequence of 'N' space-separated non-negative integers A[1], A[2], ..., A[i], ..., A[n], where each number in the sequence represents the height of a line draw...read more
Given a sequence of non-negative integers representing the height of lines on a cartesian plane, find two lines that form a container with the maximum area of water.
Use two pointers approach to find the maximum area
Start with the widest container and gradually move the pointers towards each other
Calculate the area at each step and update the maximum area
The area is calculated as the minimum height of the two lines multiplied by the distance between them
Q36. Count Ways to Climb Stairs Problem
Given a staircase with a certain number of steps, you start at the 0th step, and your goal is to reach the Nth step. At every step, you have the option to move either one step...read more
Q37. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Q38. Rahul and Minimum Subarray Challenge
Rahul, who is passionate about programming, is learning about arrays and lists. He faces a challenging problem to determine the smallest subarray length in a given array 'AR...read more
The problem is to find the length of the smallest subarray in a given array with its sum greater than a given value.
Iterate through the array and keep track of the current subarray sum
If the current sum becomes greater than the given value, update the minimum subarray length
If the current sum becomes negative, reset the sum and start a new subarray
Return the minimum subarray length
Q39. Minimum Cost to Make String Valid
Given a string containing only '{' and '}', determine the minimum cost required to make the string valid. A string is considered valid if for every opening bracket '{', there i...read more
Q40. Minimum Fountains Activation Problem
In this problem, you have a one-dimensional garden of length 'N'. Each position from 0 to 'N' has a fountain that can provide water to the garden up to a certain range. Thus...read more
Q41. Stocks are Profitable Problem Statement
You are provided with an array/list 'prices', where each element signifies the prices of a stock as of yesterday and the indices represent minutes. The task is to determi...read more
Q42. Minimum Removals Problem Statement
Given an integer array ARR
of size N
and an integer K
, determine the minimum number of elements that need to be removed so that the difference between the maximum and minimum ...read more
Q43. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
Q44. Largest Cycle in Maze Problem Statement
Given a maze represented by 'N' cells numbered from 0 to N-1, and an array arr
of 'N' integers where arr[i]
denotes the cell number that can be reached from the 'i'-th ce...read more
Q45. Nth Term of Geometric Progression (GP) Series
Determine the Nth term of a geometric progression (GP) series given the first term, common ratio, and the term number.
Explanation:
The general form of a GP series ...read more
Q46. Frequency in a Sorted Array Problem Statement
Given a sorted array ARR
and a number X
, your task is to determine the count of occurrences of X
within ARR
.
Note:
- If
X
is not found in the array, return 0. - The ar...read more
The task is to count the number of occurrences of a given number in a sorted array.
Use binary search to find the first and last occurrence of the given number in the array.
Subtract the indices of the first and last occurrence to get the count.
Handle the case when the number is not found in the array.
Q47. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Given an array and a target sum, find all pairs of elements in the array that add up to the target sum.
Create an empty list to store the pairs
Iterate through the array and for each element, check if there is a complement (target sum minus the current element) in the array
If a complement is found, add the pair (current element, complement) to the list
Sort the list of pairs in non-decreasing order of their first value
If two pairs have the same first value, sort them based on th...read more
Q48. Dice Throw Problem Statement
You are provided with D
dice, each having F
faces numbered 1 to F
, inclusive. Your task is to determine the number of possible ways to roll the dice such that the sum of the face-up...read more
Q49. Majority Element - II Problem Statement
Given an array/list ARR
of integers with length 'N', identify all elements that appear more than floor(N/3)
times within the array/list.
Input:
T (number of test cases)
Fo...read more
Q50. Car Pooling Capacity Problem
You are a cab driver with a car that initially has 'C' empty seats. The car moves in a straight line towards the forward direction only. Your job is to determine if it is possible t...read more
Interview Questions of Similar Designations
Top Interview Questions for Software Developer Intern Related Skills
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month