Filter interviews by
A software intern developer is a student or recent graduate who works on software development projects under the guidance of experienced developers.
Assists in coding, testing, and debugging software applications
Learns new programming languages and technologies
Participates in team meetings and contributes to project discussions
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.
T (number of test c...
Identify elements in an array that appear more than floor(N/3) times using efficient counting methods.
Use a HashMap to count occurrences of each element in the array.
Calculate the threshold as floor(N/3) to determine majority elements.
Iterate through the HashMap to collect elements that exceed the threshold.
Example: For array [3, 2, 3], floor(3/3) = 1, so 3 is a majority element.
Example: For array [1, 1, 2, 2, 3, ...
Given an array arr
of N
non-negative integers, determine whether the array consists of consecutive numbers. Return true if they do, and false otherwise.
The first line of inpu...
Determine if an array of non-negative integers contains consecutive numbers.
Consecutive Numbers: An array is consecutive if it contains all integers from the minimum to the maximum value without any gaps.
Unique Elements: The array must have unique elements; duplicates would invalidate the consecutive condition.
Range Check: The difference between the maximum and minimum values should equal N-1, where N is the numbe...
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 min...
Determine the minimum removals from an array to ensure the max-min difference is ≤ K.
Sort the array: Sorting helps in easily finding the maximum and minimum elements in any subarray.
Two-pointer technique: Use two pointers to find the largest subarray where the difference between max and min is ≤ K.
Calculate removals: The minimum removals will be the total elements minus the size of the valid subarray.
Example: For ...
Given a binary tree where each node contains an integer value, and an integer X, your task is to delete all leaf nodes that have the value X. Continue to remove newly formed ...
Delete all leaf nodes with value X in a binary tree until no such leaves exist.
Traverse the tree in postorder fashion to delete leaf nodes with value X
Recursively call the function on left and right subtrees
Update the root of the tree after removing leaf nodes with value X
Ninja owns an electronic shop and possesses 'N' bulbs. To verify the quality of the bulbs, Ninja performs a unique technique. After 'N' rounds of this process, bulbs that rema...
Determine the number of good quality bulbs remaining after 'N' rounds of a unique technique.
In each round, bulbs are toggled based on their position (e.g. every second bulb, every third bulb, etc.)
At the end of 'N' rounds, count the bulbs that remain on to determine the number of good quality bulbs.
Example: For N = 4, bulbs 1 and 4 remain on, so the output is 2.
You are tasked with finding the path from a leaf node to the root node in a binary tree, such that this path has the maximum sum among all root-to-leaf paths.
Find the path from a leaf node to the root node in a binary tree with the maximum sum.
Traverse the binary tree from leaf to root while keeping track of the sum along the path.
Compare the sums of all root-to-leaf paths and return the path with the maximum sum.
Use recursion to traverse the tree efficiently and update the sum as you go.
Consider edge cases like null nodes and negative values in the tree.
Given a binary tree and the values of two distinct nodes, determine the distance between these two nodes in the tree. The distance is defined as the minimum numb...
Calculate the distance between two nodes in a binary tree.
Traverse the tree to find the paths from the root to each node
Find the lowest common ancestor of the two nodes
Calculate the distance by adding the distances from the LCA to each node
Return -1 if either node is not present in the tree
You are given a string that represents time in the format hh:mm
. Some of the digits are blank (represented by ‘?’
). Your task is to fill in ‘?’
such that the time represented...
Given a string representing time with some digits as '?', fill in '?' to get maximum time.
Iterate through each digit of the input string and replace '?' with the maximum possible digit based on the position.
For the first digit (hours), if it is '?', replace it with '2' if the second digit is also '?', else replace it with '1'.
For the second digit (hours), if it is '?', replace it with '3' if the first digit is '2'...
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two...
The problem involves finding the number of distinct ways to climb N stairs by taking 1 or 2 steps at a time.
Use dynamic programming to solve the problem efficiently.
The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the (N-2)th stair.
Handle base cases for N=0 and N=1 separately.
Consider using modulo operation to avoid overflow for large values of N.
Dsa mostly from arrays,trees.
posted on 6 Oct 2024
Asked single que which is dp
Topics : Trees, graphs
I applied via LinkedIn and was interviewed in Jul 2023. There were 2 interview rounds.
I applied via Approached by Company and was interviewed before Jun 2023. There were 2 interview rounds.
Two coding questions to be done
I applied via Approached by Company and was interviewed before Jan 2023. There were 3 interview rounds.
Swap two numbers with any of the language
Discuss about your family members
A software intern developer is a student or recent graduate who works on software development projects under the guidance of experienced developers.
Assists in coding, testing, and debugging software applications
Learns new programming languages and technologies
Participates in team meetings and contributes to project discussions
I appeared for an interview before May 2023.
Array string questions
I appeared for an interview in Feb 2021.
Round duration - 60 minutes
Round difficulty - Easy
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, maintain...
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
Given an array of integers, determine the sum of bit differences among all possible pairs that can be formed using the elements of the array.
The b...
Calculate sum of bit differences among all pairs in an array of integers.
Iterate through all pairs of elements in the array
Convert each pair of elements to binary representation
Count the differing bits in the binary representations
Sum up the differing bits for all pairs to get the final result
Round duration - 60 minutes
Round difficulty - Medium
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) + ....
Calculate and print the sum of least common multiples (LCM) for each integer from 1 to N with N.
Iterate from 1 to N and calculate LCM of each number with N
Sum up all the calculated LCMs to get the final result
Implement a function to calculate LCM of two numbers
Given a 9x9 Sudoku board, your task is to fill the empty slots and return the completed Sudoku solution.
A Sudoku is a grid composed of nine 3x3 smaller grids. The challenge is to fill in the...
Implement a Sudoku solver for a 9x9 grid with constraints on row, column, and 3x3 grid.
Create a recursive function to solve the Sudoku puzzle by trying out different numbers in empty slots.
Use backtracking to backtrack and try different numbers if a conflict is encountered.
Ensure each number appears only once in each row, column, and 3x3 grid.
Implement a function to check if a number can be placed in a particular posit...
Round duration - 60 minutes
Round difficulty - Hard
Given a singly linked list of integers and a reference to a node, your task is to delete that specific node from the linked list. Each node in the linked li...
Given a singly linked list of integers and a reference to a node, delete the specified node from the linked list.
Traverse the linked list to find the node to be deleted.
Update the pointers to skip over the node to be deleted.
Print the modified linked list after deletion.
Ensure the node to be deleted is not the tail node.
Round duration - 60 Minutes
Round difficulty - Easy
Timing was around 3 pm.
Given an array ARR
consisting of N
integers, your goal is to determine the maximum possible sum of a non-empty contiguous subarray within this array.
Find the maximum sum of a contiguous subarray within an array of integers.
Use Kadane's algorithm to find the maximum subarray sum efficiently.
Initialize two variables: maxEndingHere and maxSoFar.
Iterate through the array and update the variables accordingly.
Return the maxSoFar as the result.
Tip 1 : Practice on white board
Tip 2 : Spend daily some time
Tip 3 : Practice previous questions
Tip 1 : Resume should be short and neat
Tip 2 : Keep only thing in which you are sure you will answer all questions
I appeared for an interview in Feb 2021.
Round duration - 30 minutes
Round difficulty - Medium
This round was to test if Google should spend time in interviewing me or not. I was asked around 8 questions that any coder must know, like time complexities of various algorithms, basic understanding of trees and graphs, some concepts specific to the chosen language etc. Apart from these, there was a question to test my mental arithmetic that can be important for system design interviews.
This round went pretty well for me and I moved to the next Round.
Given a binary tree with N
nodes, determine whether the tree is a Binary Search Tree (BST). If it is a BST, return true
; otherwise, return false
.
A binary search tree (BST)...
Validate if a binary tree is a Binary Search Tree (BST) based on given properties.
Check if the left subtree of a node contains only nodes with data less than the node's data.
Verify if the right subtree of a node contains only nodes with data greater than the node's data.
Ensure that both the left and right subtrees are also binary search trees.
Traverse the tree in level order form to validate the BST properties.
Return t...
Round duration - 45 minutes
Round difficulty - Hard
This round was to test my coding aptitude. It was a 45 minutes round and I was asked 2 questions. One of the questions was based on Dynamic Programming and the other question was on Arrays that involved usage of Heaps. I was able to approach both the problems but could code only one due to time constraints. The interviewer was pretty friendly and quite helping. She guided me wherever I went wrong.
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 task is to find the total number of ways to make change for a specified value using given denominations.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the number of ways to make change for each value up to the specified value.
Initialize the array with base cases and then iterate through the denominations to fill up the array.
The final answer will be in the last cell of the arra...
Tip 1 : Regular practice on online platforms
Tip 2 : Must do questions from geeksforgeeks.org are very helpful
Tip 3 : Experience in some team projects is a plus point
Tip 1 : Mention good projects in resume
Tip 2 : Team projects will help a lot
I appeared for an interview in Oct 2020.
Round duration - 60 minutes
Round difficulty - Medium
Given a positive integer N
, your task is to determine the minimum number of steps required to reduce N
to 1.
1) Subtract 1 from it: n = n -...
Implement a function to find the minimum steps to reduce a positive integer to 1 using given operations.
Use dynamic programming to store the minimum steps for each number from 1 to N.
Iterate through each number from 1 to N and calculate the minimum steps based on the given operations.
Consider the cases where N is divisible by 2 or 3, and also when subtracting 1 is the only option.
Return the minimum steps required to re...
Round duration - 100 minutes
Round difficulty - Medium
My interview was held from 3 to 3:50 and 4 to 4:50 in the evening . I sat in a silent place of my room with no disturbances in my room.
The interviewer first asked me to introduce myself then he did the same, he then gave me a problem of sliding window and we discussed to reach on a optimal solution then I wrote the code for it . Then he asked me to ask if I had any questions , I asked some questions regarding their work culture , what do they expect from me and what work will I be given there as an SDE -intern. Second interview was almost the same the problem was of dynamic programming .
You are given an array/list of integers with length 'N'. A sliding window of size 'K' moves from the start to the end of the array. For each of the 'N'-'K'+1 possi...
The problem involves finding the maximum element in each sliding window of size 'K' in an array of integers.
Use a deque to store indices of elements in the current window in decreasing order of their values.
Remove indices that are out of the current window from the front of the deque.
Add the maximum element (at the front of the deque) to the result for each window.
Round duration - 50 minutes
Round difficulty - Medium
I have already given the description in the previous round.
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 ma...
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
Tip 1 : Solve as many questions and learn as many concepts as you can from gfg and leetcode.
Tip 2 : Solve the questions on notepad or notebook because there you won't get an editor to point out your mistakes.
Tip 3 : Submit your code when you are completely satisfied because there you won't get to run and debug your code.
Tip 1 : Keep it 1 page short and catchy.
Tip 2 : Do not brag in your Resume your resume should be honest and should represent exactly what you are.
Top trending discussions
based on 8 interview experiences
Difficulty level
Duration
based on 2 reviews
Rating in categories
Software Engineer
3k
salaries
| ₹33 L/yr - ₹65 L/yr |
Software Developer
2.1k
salaries
| ₹33.2 L/yr - ₹61.6 L/yr |
Senior Software Engineer
1.2k
salaries
| ₹35.9 L/yr - ₹70 L/yr |
Sde1
398
salaries
| ₹32.6 L/yr - ₹60 L/yr |
Data Scientist
379
salaries
| ₹26.8 L/yr - ₹50 L/yr |
Yahoo
Amazon
Microsoft Corporation