Can someone please share the optimal solutions for the Atlassian DS question bank
Company: Atlassian
Role: unknown
Interview Stage: unknown
Location: unknown
Year: unknown
Original Post Content:
Can someone please share the optimal solutions for the Atlassian DS question bank?
Find the closest Org for target Employees
a) Imagine you are the team that maintains the Atlassian employee directory. At Atlassian – there are multiple groups, and each can have one or more groups. Every employee is part of a group. You are tasked with designing a system that could find the closest common parent group given a target set of employees in the organization.
b) The Atlassian hierarchy sometimes can have shared groups across an org or employees shared across different groups – How will the code evolve in this case if the requirement is to provide ONE closest common group
c) The system now introduced 4 methods to update the structure of the hierarchy in the org. Suppose these dynamic updates are done in separate threads while getCommonGroupForEmployees is being called, How will your system handle reads and writes into the system efficiently such that at any given time getCommonGroupForEmployees always reflects the latest updated state of the hierarchy?
d) The company consists of a single level of groups with no subgroups. Each group has a set of employees.
Expanding Tennis Club
a) Implement a function that given a list of tennis court bookings with start and finish times, returns a plan assigning each booking to a specific court, ensuring each court is used by only one booking at a time and using the minimum amount of courts with unlimited number of courts available.
An example of the booking record might look like
Class BookingRecord:
Id: int // ID of the booking
Start_time: int
Finish_time: int
And our function is going to look like:
List assignCourts(List bookingRecords)
b) After each booking, a fixed amount of time, X, is needed to maintain the court before it can be rented again
c) Court only need maintenance after X amount of usage
How would you modify the code if each court also had a Y maintenance time that occurred after X bookings?
The function should now become something like
Def assign_court_with_maintainence(booking_records: list{BookingRecord],
Maintainence_time: int,
Durability: int) -> list[Court]:
d) The original problem can be made simpler by removing the “assigning each booking to a specific court” part. The candidate needs to find the minimum number of courts needed to accommodate all the bookings
e) Check if booking conflict - Write a function that if given two bookings to check if they conflict with each other
Commodity Prices
Imagine you are given a stream of data points consisting of <timestamp, commodityPrice> you are supposed to return the maxCommodityPrice at any point in time.
The timestamps in the stream can be out of order, or there can be duplicate timestamps, we need to update the commodityPrice at that particular timestamp if an entry for the timestamp already exists
Create an in-memory solution tailored to prioritize frequent reads and writes for the given problem statement
Can we reduce the time complexity of the getMaxCommodityPrice to O(1) if the language does not support it? This can be done using a variable to keep the maxPrice value, but we need to update it when performing the upsert operations.
Popular content
Imagine you are given a stream of content ids along with an associated action to be performed on them
Example of contents are video, pages, posts etc. There can be two actions associated with a content id:
• increasePopularity -> increases the popularity of the content by 1. The popularity increases when someone comments on the content or likes the content
• decreasePopularity-> decreases the popularity of the content by 1. The popularity decreases when a spam bot’s/users comments are deleted from the content or its likes are removed from the content
• content ids are positive integers
Implement a class that can return the mostPopular content id at any time while consuming the stream of content ids and its associated action. If there are no contentIds with popularity greater than 0, return -1