Software Developer Intern
1000+ Software Developer Intern Interview Questions and Answers
You are given an array βARRβ of size N. Your task is to find out the sum of maximum and minimum elements in the array.
Follow Up:
Can you do the above task in a minimum number of comparisons? ...read more
You are given an array 'ARR' of integers of length 'N' and a positive integer 'K'. You need to find the maximum elements for each and every contiguous subarray of size K of the array.
For exampl...read more
Software Developer Intern Interview Questions and Answers for Freshers
There is a river which flows in one direction. One day, the river has 'N' number of fishes. You are given an array 'FISHES' of integers representing the size of 'N' fishes. The fishes are present in t...read more
Ninjas are trying to hack a system of a terrorist organization so that they can know where they will be going to attack next. But to hack the system and to get access ...read more
You are given a sorted array 'A' of length 'N', two integers 'K' and 'X'. Your task is to print 'K' integers closest to 'X', if two integers are at the same distance return the smaller on...read more
Ram went to a specialty candy store in Ninjaland which has 'N' candies with different costs.
The Candy shop gives a special offer to its customers. A customer can buy a ...read more
Share interview questions and help millions of jobseekers π
You have been given two integers βXβ and βYβ which are the first two integers of a series and an integer βNβ. You have to find the Nth number of the series using the Fibo...read more
Given a number N, figure out if it is a member of fibonacci series or not. Return true if the number is member of fibonacci series else false.
Fibonacci Series is defined by the recurrence
F(n)...read more
Software Developer Intern Jobs
You are the manager of a hotel having 10 floors numbered 0-9. Each floor has 26 rooms [A-Z]. You will be given a sequence of strings of the room where β+β suggests the room is booked and β-β suggests...read more
Kevin has βNβ buckets each consisting of some fruits. Kevin wants to eat at least βMβ fruits and so, he decided to set a marker (integer) as maximum as possible such that if he eats βnumber ...read more
You have 'N' empty pens whose refills have been used up. You have 'R' rupees in your pocket. You have two choices of operations that you can perform each time.
1) Recycle 1 empty pen and get 'K' r...read more
You are given a string (STR) of length N.
Your task is to find the longest palindromic substring. If there is more than one palindromic substring with the maximum length, return the...read more
For a given array with N elements, you need to find the length of the longest subsequence from the array such that all the elements of the subsequence are sorted in strictly increa...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 length of the longest increasing subsequence seen so far.
Use dynamic programming to solve the problem efficiently.
The time complexity of the solution should be O(N^2) or better.
Consider edge cases such as an empty array or an array with only one element.
You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or trailing spaces but in the ou...read more
You are given an unsorted array/list 'ARR' of 'N' integers. Your task is to return the length of the longest consecutive sequence.
The consecutive sequence is in the form ['NUM', 'NU...read more
You are given an array consisting of N integers, and an integer, K. Your task is to determine the total sum of the minimum element and the maximum...read more
You are blindfolded and 10 coins are placed in front of you on the table. You are allowed to touch the coins, but canβt tell which way up they are by feel. You are told that there are 5 coins head up, and 5 coi...read more
For a given Binary Tree of integers, replace each of its data with the depth of the tree.
Root is at depth 0, hence the root data is updated with 0. Replicate the same further going down ...read more
You have been given a string 'S' containing only three types of characters, i.e. '(', ')' and '*'.
A Valid String is defined as follows:
1. Any left parenthesis '(' must have a corresponding right p...read more
Assume you initially have an empty array say βARRβ.
You need to return the updated array provided that some βQβ number of queries were performed on this array.
The queries are of two types:
1. 1 βVALβ,...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
You have been given an array 'ARR' of βNβ integers. You have to find the minimum number of jumps needed to reach the last index of the array i.e βN - 1β if at any index βiβ we can jump to an index βi +...read more
Ninja has recently started a startup. In his startup, there is only one conference room for a meeting. Ninja receives an array/list βMEETINGSβ of back-to-back appointment requests and is d...read more
Youβre given two integers N and K, your task is to find the Kth permutation of the sequence of first N natural numbers.
For Example :
If N = 3 and K = 3. The ...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
You are given an array βArrβ consisting of βNβ distinct integers and a positive integer βKβ. Find out Kth smallest and Kth largest element of the array. It is guaranteed...read more
You are given an array 'ARR' of integers of length N. Your task is to find the first missing positive integer in linear time and constant space. In other words, find the lowest positive in...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.
Given a string 'S' of length 'L', return the length of the longest substring without repeating characters.
Example:
Suppose given input is "abacb", then the length ...read more
You are given an array consisting of N positive integers, your task is to count the number of distinct possible values that can be obtained by taking the bitwise OR of ...read more
You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.
A cell is said to be connected to...read more
Ninja has given a fence, and he gave a task to paint this fence. The fence has 'N' posts, and Ninja has 'K' colors. Ninja wants to paint the fence so that not more than two adjacent posts hav...read more
For a given string(str), remove all the consecutive duplicate characters.
Example:
Input String: "aaaa" Expected Output: "a" Input String: "aabbbcc" Expected Output: "abc"
Input F...read more
You are given an integer βNβ , calculate and print the sum of :
LCM(1,N) + LCM(2,N) + .. + LCM(N,N)
where LCM(i,n) denotes the Least Common Multiple of the integers βiβ and βNβ.
Input Format:
The fir...read more
Design and implement a Least Frequently Used(LFU) Cache, to implement the following functions:
1. put(U__ID, value): Insert the value in the cache if the key(βU__IDβ) is not already present or update ...read more
There are βNβ stations on the route of a train. The train goes from station 0 to βNβ - 1. The ticket cost for all pairs of stations (i, j) is given where ...read more
There are 'N' number of subjects and the ith subject contains subject[i] number of problems. Each problem takes 1 unit of time to be solved. Also, you have 'K' friends, and you...read more
You have been given a graph consisting of βNβ vertices numbered from 1 to βNβ. The graph has βMβ edges. In an operation, you can shift an edge between two directly co...read more
A thief is robbing a store and can carry a maximal weight of W into his knapsack. There are N items and the ith item weighs wi and is of value vi. Considering the constraints of the maximum ...read more
Given a sequence of βNβ space-separated non-negative integers A[1],A[2],A[3],......A[i]β¦...A[n]. Where each number of the sequence represents the height of the line drawn at point 'i'. ...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
You have been given a number of stairs. Initially, you are at the 0th stair, and you need to reach the Nth stair. Each time you can either climb one step or two steps. You are ...read more
You are given an array/list 'ARR' consisting of N integers, which contains elements only in the range 0 to N - 1. Some of the elements may be repeated in 'ARR'. Your task is to find all ...read more
Rahul is a programming enthusiast. He is currently learning about arrays/lists. One day his teacher asked him to solve a very difficult problem. The problem was to find the length of t...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
Ninja has been given a string βSTRβ containing either β{β or β}β. 'STRβ is called valid if all the brackets are balanced. Formally for each opening bracket, there must be a clos...read more
There is a one-dimensional garden of length 'N'. On each of the positions from 0 to 'N', there is a fountain, and this fountainβs water can reach up to a certain range as explained further. In ...read more
You are given an array/list 'prices' where the elements of the array represent the prices of the stock as they were yesterday and indices of the array represent minutes. Your task is to fin...read more
You have been given an array/list "ARR" consisting of 'N' integers. You have also given an integer 'K'.
Your task is to find the minimum number of elements that should be removed from "ARR" (pos...read more
You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change fo...read more
You are given a maze consisting of N cells numbered from 0 to N - 1 and an array βarrβ of N integers in which arr[i] contains the cell number that can be reached from βiβth cell in one step. You ar...read more
You are given the first term (A), the common ratio (R) and an integer N. Your task is to find the Nth term of the GP series.
The general form of a GP(Geometric Progression) series is A, A(R...read more
You are given a sorted array 'ARR' and a number 'X'. Your task is to count the number of occurrences of 'X' in 'ARR'.
Note :
1. If 'X' is not found in the array, return 0. 2. The give...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.
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.
Note:
Each pair shou...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
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