Meta Software Engineer - Machine Learning
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)
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]
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