Software Engineer, new Grad

Software Engineer, new Grad Interview Questions and Answers

Updated 10 Aug 2018

Q1. 1. There is a train that passes the following path: L / \ ... L / \ ... L Each junction tells us the path it is going to take. Once the train passes it'll change the switch at the function. We dont care after t...

read more
Ans.

Determining the state of switches/junctions after N trains have passed through them.

  • Create an array to represent the state of each switch/junction

  • Iterate through each train and update the state of the corresponding switch/junction

  • Use a loop to simulate the passing of trains and updating of switches/junctions

  • Return the final state of the switches/junctions

Q2. 2. Level order traversal of BST

Ans.

Level order traversal of a binary search tree (BST) is a breadth-first search algorithm that visits each level of the tree from left to right.

  • Use a queue to keep track of the nodes to be visited

  • Start with the root node and enqueue it

  • While the queue is not empty, dequeue a node and visit it

  • Enqueue the left and right child of the visited node if they exist

  • Repeat until all nodes have been visited

Q3. 1. Move Zeros from Leetcode

Ans.

Move all zeros to the end of the array while maintaining the relative order of the non-zero elements.

  • Iterate through the array and keep track of the index to place the next non-zero element.

  • When encountering a non-zero element, swap it with the element at the current index.

  • After iterating through the array, all zeros will be moved to the end while maintaining the order of non-zero elements.

Q4. 2. Merge subsets with small twist

Ans.

Merge subsets of strings with a twist

  • Merge subsets of strings into a single array

  • The twist is that each subset should be reversed before merging

  • Return the merged array of reversed subsets

Are these interview questions helpful?

Q5. 4. Number of islands with a twist

Ans.

Count the number of islands in a grid, where an island is a group of connected 1s.

  • Use depth-first search (DFS) or breadth-first search (BFS) to traverse the grid

  • For each cell with a 1, mark it as visited and explore its neighboring cells

  • Count the number of times you start a new DFS or BFS traversal

Software Engineer, new Grad Jobs

0
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

4.4
 • 855 Interviews
View all

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

Software Engineer, new Grad Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter