Software Developer Intern
1000+ Software Developer Intern Interview Questions and Answers for Freshers

Asked in Deutsche Bank

Q. 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
Find the minimum cost to reach the destination via train using given ticket costs for each pair of stations.
Create a 2D array to store the costs from each station to the final destination.
Use dynamic programming to calculate the minimum cost to reach each station.
Iterate through the stations and update the minimum cost based on the previous stations.
Return the minimum cost to reach the final station.

Asked in HyperVerge

Q. 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

Asked in Amazon

Q. 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
Find the Kth smallest and largest elements in an array.
Sort the array and return the Kth element for smallest and (N-K+1)th element for largest.
Use a priority queue to efficiently find the Kth smallest and largest elements.
Handle edge cases where K is equal to 1 or N.

Asked in American Express

Q. 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
The task is to find the minimum number of deletions needed in a string to ensure each character appears a unique number of times.
Iterate through the string and count the frequency of each character
Track the frequencies in a hashmap
Identify the characters with duplicate frequencies and calculate the minimum deletions needed
Return the minimum number of deletions for each test case

Asked in JUSPAY

Q. 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
Identify the length of the largest cycle in a maze represented by cells and an array of integers.
Iterate through each cell and find cycles using DFS or Floyd's Tortoise and Hare algorithm.
Keep track of visited cells and cycle lengths to identify the largest cycle.
If a cell has no exit (-1), mark it as visited to avoid infinite loops.

Asked in SimplifyVMS

Q. Lazy Santa Problem Statement
It's Christmas and Santa has 'K' gifts to distribute. There are 'N' children standing in a straight line in the park due to COVID restrictions. You are given an array distance
conta...read more
Find the minimum distance Santa must travel to distribute 'K' gifts to 'K' different children standing in a straight line.
Sort the array 'distance' in ascending order to simplify the problem.
Calculate the distance between each adjacent child and find the minimum sum of distances for 'K' gifts.
Keep track of the minimum sum of distances as you iterate through the array.
Software Developer Intern Jobs




Asked in Amazon

Q. Longest Increasing Subsequence Problem Statement
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This subse...read more
The task is to find the length of the longest increasing subsequence in a given array.
Iterate through the array and keep track of the longest increasing subsequence length at each index.
Use dynamic programming to store the lengths of increasing subsequences ending at each index.
Return the maximum length from the dynamic programming array.

Asked in Amazon

Q. 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
Share interview questions and help millions of jobseekers 🌟

Asked in Amazon

Q. Josephus Problem Statement
Consider 'N' individuals standing in a circle, numbered consecutively from 1 to N, in a clockwise direction. Initially, the person at position 1 starts counting and will skip K-1 pers...read more
This question is about finding the position of the last person surviving in a circle of N people, where each person kills the Kth person in a clockwise direction.
Implement a function that takes the number of test cases, N, and K as input
For each test case, simulate the killing process by iterating through the circle and skipping K-1 people
Keep track of the position of the last person surviving and return it as the output

Asked in Bajaj Finserv Health

Q. 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
The task is to determine the number of ways to paint a fence with 'N' posts using 'K' different colors, with the constraint that not more than two adjacent posts have the same color.
Use dynamic programming to solve the problem efficiently.
Consider the cases where the last two posts have the same color and different colors separately.
Keep track of the number of ways to paint the fence at each post using a 2D array.
Apply modulo 10^9 + 7 to avoid overflow issues.
Return the final...read more

Asked in Expedia Group

Q. Problem: Deletion in Circular Linked List
You are provided with a Circular Linked List of integers and a specific integer, referred to as 'key'
.
Your task is to implement a function that locates the specified k...read more
Implement a function to delete a specific key from a Circular Linked List of integers.
Traverse the Circular Linked List to find the key to be deleted.
Update the pointers of the previous and next nodes to skip the node with the key.
Handle the case where the Circular Linked List becomes empty after deletion.
Return -1 if the Circular Linked List is empty after deletion.

Asked in Amazon

Q. Valid Sudoku Problem Statement
You are given a 9 X 9 2D matrix named MATRIX
which contains some cells filled with digits (1 to 9) and some cells left empty (denoted by 0).
Your task is to determine if there is ...read more
The task is to determine if a given 9x9 matrix can be filled with digits 1-9 to form a valid Sudoku solution.
Iterate through each cell in the matrix.
For each empty cell, try filling it with a digit from 1-9 and check if it satisfies the Sudoku conditions.
Use helper functions to check if the digit is valid in the current row, column, and sub-matrix.
If a valid digit is found, recursively fill the next empty cell.
If all cells are filled and the Sudoku conditions are satisfied, r...read more

Asked in Texas Instruments

Q. 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
Implement a function to update an array based on XOR queries.
Create an empty array to store the elements.
Iterate through each query and update the array accordingly.
Use bitwise XOR operation to update the elements.
Ensure to handle both types of queries - insert and XOR.
Return the updated array after all queries are processed.

Asked in Dunzo

Q. Asteroid Collision Problem Description
Given an array/list ASTEROIDS
representing asteroids aligned in a row, each element's absolute value identifies the asteroid's size, while its sign indicates the direction...read more
Determine the state of asteroids after collisions occur.
Iterate through the array of asteroids and simulate collisions between adjacent asteroids.
Use a stack to keep track of remaining asteroids after collisions.
Handle cases where asteroids moving in opposite directions collide and destroy each other.
Handle cases where asteroids moving in the same direction do not collide.

Asked in Amazon

Q. Flip Bits Problem Explanation
Given an array of integers ARR
of size N, consisting of 0s and 1s, you need to select a sub-array and flip its bits. Your task is to return the maximum count of 1s that can be obta...read more
Given an array of 0s and 1s, find the maximum count of 1s by flipping a sub-array at most once.
Iterate through the array and keep track of the maximum count of 1s obtained by flipping a sub-array.
Consider flipping a sub-array only when it results in increasing the count of 1s.
Update the maximum count of 1s as you iterate through the array.
Return the maximum count of 1s obtained after considering all possible sub-arrays.

Asked in DE Shaw

Q. K Max Sum Combinations Problem Statement
Given two arrays/lists A
and B
, each of size N
, and an integer K
, you need to determine the K
maximum and valid sum combinations from all possible combinations of sums g...read more
The problem involves finding the K maximum sum combinations from two arrays by adding one element from each array.
Iterate through all possible sum combinations of elements from arrays A and B.
Store the sums in a max heap to keep track of the K maximum sums.
Pop the top K elements from the max heap to get the K maximum sum combinations.

Asked in Google

Q. Remove K Corner Elements - Problem Statement
Given an array "arr" consisting of "N" integer elements, your task is to remove "K" elements from the beginning or the end of the array. You must return the maximum ...read more
Given an array, remove K elements from beginning or end to maximize sum of remaining elements.
Iterate through all possible combinations of removing K elements from beginning and end
Calculate sum of remaining elements for each combination
Return the maximum sum obtained

Asked in Amazon

Q. Count Inversions Problem Statement
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the array ...read more
The task is to count the number of inversions in an array.
Iterate through the array and for each element, compare it with all the elements that come after it.
If the current element is greater than any of the elements that come after it, increment the inversion count.
Return the inversion count as the result.

Asked in Eternal Limited

Q. 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
Design and implement a Least Frequently Used (LFU) Cache with put and get functionalities, handling capacity and frequency of use.
Implement a LFU cache with put and get functions
Handle capacity and frequency of use for eviction
Return the value of key if present, -1 otherwise
Consider multiple elements with least frequency, remove least recently used
Example: Insert, update, and retrieve values based on operations

Asked in Bounteous x Accolite

Q. 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
Assign subjects to friends to minimize maximum workload, find minimum time for most loaded friend.
Sort subjects in descending order
Assign subjects to friends one by one until all subjects are assigned
The maximum workload will be the sum of problems assigned to the friend with the most problems
Return the maximum workload as the minimum time required

Asked in Goldman Sachs

Q. Minimum Umbrellas Problem
You are provided with ‘N’ types of umbrellas, where each umbrella type can shelter a certain number of people. Given an array UMBRELLA
that indicates the number of people each umbrella...read more
Given 'N' types of umbrellas with different capacities, find the minimum number of umbrellas required to shelter exactly 'M' people.
Iterate through the umbrella capacities and try to cover 'M' people using the minimum number of umbrellas.
Keep track of the total number of people covered and the number of umbrellas used.
If it is not possible to cover 'M' people exactly, return -1.
Return the minimum number of umbrellas required to shelter exactly 'M' people.

Asked in ShareChat

Q. Network Delay Time Problem Statement
Given a network of nodes numbered from 1 to 'N', and 'M' edges. Each edge is represented by three values (u, v, w) where 'u' and 'v' are nodes, and 'w' is an integer represe...read more
Find the time it takes for a signal to travel from a given source node to all other nodes in a network.
Use Dijkstra's algorithm to find the shortest path from the source node to all other nodes.
Keep track of the minimum time taken to reach each node.
If it is impossible for the signal to reach all nodes, return -1.

Asked in Bounteous x Accolite

Q. Ninja and the Maze Problem Statement
Ninja is stuck in a maze represented as a 2D grid. He can move in four directions (Up, Down, Left, Right) until he hits a wall ('1'). Once stopped, he can choose a new direc...read more
The problem involves determining if a ninja can reach the destination in a maze by moving in four directions until hitting a wall.
Create a function that takes in the maze, starting point, and destination coordinates as input.
Implement a recursive algorithm to explore all possible paths in the maze.
Check if the destination can be reached from the starting point by moving in four directions.
Return 'True' if a path exists, otherwise return 'False'.

Asked in BNY

Q. Palindromic Substrings Problem Statement
You are given a string 'STR'. Your task is to determine the total number of palindromic substrings present in 'STR'.
Example:
Input:
"abbc"
Output:
5
Explanation:
The pa...read more
The task is to find the total number of palindromic substrings in a given string.
Iterate through each character in the string and consider it as the center of a potential palindrome
Expand outwards from the center to check if the substring is a palindrome
Count the number of palindromic substrings found

Asked in PayPal

Q. Design a Constant Time Data Structure
Create a data structure that maintains mappings between keys and values, supporting the following operations in constant time:
1. INSERT(key, value): Add or update the inte...read more
Design a constant time data structure for key-value mappings with operations like INSERT, DELETE, SEARCH, GET, GET_SIZE, and IS_EMPTY.
Use a hash table to store key-value pairs for constant time operations.
Implement INSERT by hashing the key and storing the value at the corresponding index.
For DELETE, simply remove the key-value pair from the hash table.
SEARCH can be done by checking if the key exists in the hash table.
GET retrieves the value associated with the key, returning...read more

Asked in Amazon

Q. 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.

Asked in Springworks

Q. Implementing Queue with Two Stacks
Your task is to implement a queue using two stacks. You are provided with ‘Q’ queries and need to handle them, where each query falls under one of these two operations:
- Enque...read more
Implement a queue using two stacks with enqueue and dequeue operations.
Use two stacks to simulate a queue - one for enqueue and one for dequeue.
For enqueue operation, push elements onto the enqueue stack.
For dequeue operation, if dequeue stack is empty, pop all elements from enqueue stack and push onto dequeue stack.
Return true for successful enqueue and -1 for empty dequeue.
Example: Enqueue 10, enqueue 20, dequeue (returns 10), enqueue 30, dequeue (returns 20).

Asked in TCS

Q. Jar of Candies Problem Statement
You are given a jar containing candies with a maximum capacity of 'N'. The jar cannot have less than 1 candy at any point. Given 'K', the number of candies a customer wants, det...read more
Given a jar with 'N' candies, determine the number of candies left after providing 'K' candies to a customer.
Check if 'K' is greater than 'N', return -1 if invalid
Subtract 'K' from 'N' to get the remaining candies
Output the remaining candies for each test case

Asked in Amazon

Q. Missing Number in Concatenated Sequence
You were given a sequence of consecutive nonnegative integers but missed one while appending them to create a string S
. Your task is to identify the missing integer from ...read more
The task is to find the missing number in a string of consecutive nonnegative integers.
Iterate through the string and check if each substring can form a valid number
If a substring forms a valid number, check if it is consecutive with the previous number
If a substring does not form a valid number or is not consecutive, it is the missing number
Handle edge cases such as multiple missing numbers or all numbers already present

Asked in Procol

Q. Power of a Number Problem
You are given two integers, X
and N
. Your task is to compute the value of X
raised to the power of N
(i.e., X^N
).
Input:
The first line contains an integer T
, the number of test cases....read more
Compute the value of X raised to the power of N for given integers X and N.
Read the number of test cases T
For each test case, read the values of X and N
Calculate X^N for each test case
Print the result of X^N for each test case
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Software Developer Intern Related Skills

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

