Meta Software Engineer - Machine Learning

meta logo
meta
Software Engineer - Machine Learning
July 17, 20251 reads

Summary

This post details a Meta Software Engineer - Machine Learning interview experience, focusing on two specific algorithm questions.

Full Experience

Q1) Find the buildings that have an ocean view. A building has an ocean view if any part of the building can see the ocean without being obstructed by another building.

Input = Array of numbers that represent the height of buildings.

Output = Return the indexes of the buildings that have ocean view

Example Input: [4, 3, 2, 3, 1] Output: [0, 3, 4]


Q2) Given a 2D array, print out its elements in diagonal order as shown in the below image. https://imgur.com/Ib0VUPO Example Input:

1, 2, 3 4, 5, 6 7, 8, 9

Interview Questions (2)

Q1
Buildings With an Ocean View
Data Structures & Algorithms

Find the buildings that have an ocean view. A building has an ocean view if any part of the building can see the ocean without being obstructed by another building.

Input = Array of numbers that represent the height of buildings.

Output = Return the indexes of the buildings that have ocean view

Example Input: [4, 3, 2, 3, 1] Output: [0, 3, 4]

Q2
Diagonal Traverse of 2D Array
Data Structures & Algorithms

Given a 2D array, print out its elements in diagonal order as shown in the below image. https://imgur.com/Ib0VUPO Example Input:

1, 2, 3 4, 5, 6 7, 8, 9

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!