Add office photos
Engaged Employer

Sigmoid

3.3
based on 107 Reviews
Filter interviews by

BuildMyInfra Interview Questions and Answers

Updated 13 Jan 2025
Popular Designations

Q1. Given a binary string,find out the max length of substring having equal number of 1 and 0

Ans.

Find max length of substring with equal 1s and 0s in a binary string.

  • Use a hash table to store the difference between the count of 1s and 0s seen so far.

  • If the difference is 0, update the max length seen so far.

  • If the difference is already in the hash table, update the max length using the current index and the index where the difference was first seen.

  • Return the max length.

  • Example: '1100010110' -> 8

Add your answer

Q2. Leetcode's sort 0 1 array in place

Ans.

Sort an array of 0s and 1s in place without using extra space.

  • Use two pointers approach - one for 0s and one for 1s.

  • Swap elements at the two pointers until all 0s are on the left and 1s on the right.

Add your answer

Q3. Validate binary search tree.

Ans.

Validate if a binary tree is a binary search tree

  • In-order traversal should result in a sorted array

  • Check if each node's value is within the correct range

  • Recursively validate left and right subtrees

Add your answer

Q4. Reverse K group linked list.

Ans.

Reverse K group linked list

  • Iterate through the linked list in groups of size K

  • Reverse each group of K nodes

  • Connect the reversed groups back together

Add your answer
Discover BuildMyInfra interview dos and don'ts from real experiences

Q5. Nearest Left Greater element.

Ans.

Find the nearest element on the left side of an array that is greater than the current element.

  • Iterate through the array from right to left.

  • Use a stack to keep track of elements that are greater than the current element.

  • Pop elements from the stack until finding a greater element or the stack is empty.

  • If a greater element is found, that is the nearest left greater element.

  • If the stack is empty, there is no nearest left greater element.

Add your answer

Q6. Leetcode's Maximum Path Sum

Ans.

Find the maximum path sum in a binary tree

  • Use recursion to traverse the binary tree and calculate the maximum path sum at each node

  • At each node, calculate the maximum path sum that includes the current node and return the maximum path sum that does not include the current node

  • Update a global variable to keep track of the maximum path sum found so far

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at BuildMyInfra

based on 5 interviews
Interview experience
3.6
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Development Engineer II Interview Questions from Similar Companies

4.1
 • 28 Interview Questions
4.2
 • 10 Interview Questions
View all
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
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

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