Fluently Translated English: Organized High-Frequency Questions for Yelp OA | Two HackerRank Questions in Speed and Strategy Plus Preparation Guide

81 Views
No Comment

Just finished it recently Yelp OA, the overall experience can be summarized in one sentence: the questions are not difficult, but if you write slowly, you will be late. This time it is the standard configuration: the platform is HackerRank, the number of questions is 2, and the time is usually about 60 minutes (I finished it in 20 minutes early this time). I will share some high-frequency real questions for everyone's benefit.

Fluently Translated English:Organized High-Frequency Questions for Yelp OA | Two HackerRank Questions in Speed and Strategy Plus Preparation Guide

1. Service interruption

Problem Description

The SREs at Yelp need to identify all dependencies between services in the system. When a service experiences an outage, it cascades recursively to its downstream sub-services.

Here is the translated text: Given service listServicesEach service includesService_idList of Parent Service IDsParent_service_idsList of Interrupt Service Routines (ISRs)Service outagesAnd its intended purpose/target service.TargetServiceOne must judge the status of the target service based on the following rules:

  1. OperationalThe service itself did not experience a disruption, and none of its direct sub-services (if any) experienced such disruptions.
  2. Partial OutageService availability was not interrupted, but at least one of its direct sub-services experienced an interruption.
  3. Complete OutageService experiences an outage, and all of its directly dependent services (if any) are also out. The final state returned for the target service is:OperationalNone providedPartial Downturn Or Total OutageNone The text "。" is an empty placeholder and does not contain any meaningful content to translate. Please provide a proper sentence or phrase for translation.

Example

InputNone provided

JSON

{
  "services": [
    {"serviceId": 1, "parentServiceIds": []},
    {"serviceId": 2, "parentServiceIds": [1]},
    {"serviceId": 3, "parentServiceIds": [2]},
    {"serviceId": 4, "parentServiceIds": [2]},
    {"serviceId": 5, "parentServiceIds": [1]},
    {"serviceId": 6, "parentServiceIds": [5]}
  ],
  "outages": [2,3],
  "targetService": 2
}

OutputNone providedTotal Outage

ExplainNone provided

  • Service 2 is marked as completely interrupted because it itself is in the list of interruptions, and both its direct sub-services 3 and 4 have also experienced interruptions.
  • Service 1 is not interrupted itself but a direct sub-service 2 is, resulting in partial interruption; Service 5 is not interrupted itself and sub-service 6 is also not interrupted, resulting in normal status.

Load balancing

Problem Description

Yelp's website and mobile app are supported by multiple services with instances deployed in different configurations. A weighted round-robin load-balancing strategy is required, where new requests are directed to the instance that has the smallest ratio of current workload/work threads to weight; if this ratio is the same for multiple instances, the server with the smaller ID will be chosen first.

Input

  • Incoming_requestsésTotal Number of Requests to Handle
  • ServersServer list, each server containingNone The input "id" does not contain any text to translate. Please provide the text you would like translated.(unique ID),Number_of_workers(workers / weight),Load(Number of Current Requests)

Output

Output the server IDs in request order, with each ID on a new line and indicating the server to which the request was routed.

Request

  1. Output as a list of server IDs, one per row;
  2. Select by server ID in ascending order when the ratio is the same.
  3. The list of servers is displayed in ascending order by ID.

Example

InputNone provided

JSON

{
  "incoming_requests": 6,
  "servers": [
    {"id": 1, "numWorkers": 5, "load": 2},
    {"id": 2, "numWorkers": 2, "load": 1},
    {"id": 3, "numWorkers": 1, "load": 0}
  ]
}

OutputNone provided

Plaintext

3
1
2
1
1
1

ExplainNone provided

Calculate server allocations.Load/num_workersRatio:

  • Server 3: 0/1 = 0 (minimum), prioritized allocation;
  • Subsequent requests are allocated in order of value + ID rule and ultimately result in the above output.

Active Sellers

Problem Description

Given a list of Yelp user interaction events, return a list of active merchant IDs (in ascending order).

Engagement Determination Criteria

A merchant is considered active if the number of its events occurring in at least two event types exceeds the average occurrence frequency for all merchants across those same event types.

Average Calculation Rule

The average value for a certain event type is the average of the number of occurrences of that event provided by all merchants (excluding those that do not provide data for that particular event).

Note

  1. No duplicate event types will appear from the same merchant;
  2. Effective Event Types:Photo_views does not require translation as it is likely an abbreviation or term specific to a particular context, possibly within a database or API interface for image-related data. If clarification on its usage is needed in the English version, please provide additional information.None providedAdsNone providedPage viewsNone providedReviewsNone The text "。" is an empty placeholder and does not contain any meaningful content to translate. Please provide a proper sentence or phrase for translation.

Example

InputNone provided

Plaintext

Event('ads', 7, 3)
Event('ads', 8, 2)
Event('ads', 5, 1)
Event('page_views', 11, 2)
Event('page_views', 12, 3)
Event('photo_views', 10, 3)
Event('reviews', 7, 2)

OutputNone provided[2, 3]

ExplainNone provided

  • Businessperson 2:Ads(8) ≥ Average value \((7 + 8 + 5) / 3 = 6.67,\)Page viewsThe average value is 11.5? No, 11 < 11.5;Reviews(7) ≥ Mean; meets 2 events, andAdsNone providedReviewsMeet/Earn Certification;
  • Merchant 3:Ads(5) < 6.67;Page views≥11.5;Photo_views does not require translation as it is likely an abbreviation or term specific to a particular context, possibly within a database or API interface for image-related data. If clarification on its usage is needed in the English version, please provide additional information.≥ Average value 10; meets two events达标;
  • The final active merchants are 2 and 3, in ascending order.

Only Entree

Problem Description

Given a list of dishes for a restaurant, each dish is defined by its ingredient list. If the sets of ingredients for two dishes are identical (the order of ingredients does not matter), they are considered to be one and the same dish. The number of unique dishes in the menu needs to be counted.

Input

MealsMenu items, each containingName(Name),Ingredients(List of Ingredients)

Output

The quantity of only one dish.

Example

InputNone provided

Plaintext

Meals: [
  {name: "Basic Burger", ingredients: ["Lettuce", "Tomato", "Onion", "Patty"]},
  {name: "Chief Cheese Burger", ingredients: ["Cheese", "Tomato", "Patty", "Lettuce"]},
  {name: "Jay's Burger", ingredients: ["Onion", "Tomato", "Patty", "Lettuce"]},
  {name: "High Water Sandwich", ingredients: ["Tomato", "Patty", "Lettuce", "Cheese"]}
]

OutputNone provided1

ExplainNone provided

The ingredients for all dishes collectively compriseTomato, Patty, Lettuce, Cheese/OnionAfter deduplication, it is consistent. Therefore, the number of unique dishes is 1.

Chain Brand Statistics

Problem Description

Given merchant data (including brand names, city of location, and ID), input a string representing a city, and return the number of franchise stores for each branded chain in that city. The results should be sorted according to the following rules:

  1. Number of stores in descending order;
  2. Rank by brand name in alphabetical order when the number of store locations is the same.

Input

List of merchants (format: brand name – city – ID), example input includes merchant data for the Austin city.

Output

Chain Brands Sorted by Rules - List of Store Numbers, Example Output for Austin:

Plaintext

Whole Foods – 2  
Peet's Coffee – 1  
Starbucks – 1

Note

Input has been parsed successfully, requires implementation of a function that takes as input a list of merchants and a city string, and outputs a list of chain brands with their respective number of stores.

What Exactly Should I Prepare for My YPO/Various OA?

If you need solutions and answers to these frequent practice questions, or if you want to access more real exam questions from major companies, please let me know. Contact us Here you go.

If you are preparing for a large company’s OA or interview and need some professional assistance, I can help provide support: I offer pro writing assistance for platforms like HackerRank, NiuKe Network, and Codesignal to ensure all test cases pass 100%, with no charge if not passed; During VO interviews, experts with a CS background in North America can provide real-time thought guidance to help you clarify your思路; Additionally, I also offer proxy interview services and full assistance throughout the process from OA to negotiation for an offer. Other services such as simulated interviews, algorithm tutoring, and resume optimization are also available based on your needs.

Feel free to message me for a detailed discussion and I will provide you with the appropriate solution based on your specific situation. Wishing everyone a successful interview and getting the offer they desire as soon as possible!

author avatar
Jory Wang Senior Software Engineer at Amazon
Senior Amazon Engineer with rich practical experience in the development of core systems for infrastructure, specializing in system scalability, reliability, and cost optimization. Currently focused on mentoring FAANG SDE interviews, helping over 30 candidates secure L5/L6 offers within a year.
END
 0