Facebook London 2022 Jan

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-03-19Added By Anonymous
Source: Link

Company: Meta
Role: unknown
Interview Stage: unknown
Location: London
Year: 2022

Original Post Content:

- remove an element from a linkedList: https://leetcode.com/problems/remove-linked-list-elements/

- find if two islands are connected: assumes that you have a, b, c, d, e, f all respresenting islands and you recieve a map of Islands and the island next to it (a,b), (b,c), (c,d) and (e,f). There's a way from a to d so your method will return true as a,d is connected through b,c but there's no way from d to f. write a method to return true if two islands are connected and false if now.
Solution: imagine this as a graph problem and implement an adjecency list then traverse using BFS to tell if two islands are connected or not.

Comments