Starbucks Online Assessment Experience Sharing|Real Questions + Idea Analysis

920 Views
No Comment

As soon as everyone hears starbucks ,the first reaction may still be coffee and stores, but in fact they have invested very much in digitalization, and the strength of the technical team should not be underestimated. Many students will be surprised: Starbucks has a technical post? In fact, their OA difficulty is not low at all. This time, I have compiled a real OA recall question, which includes Python programming and algorithm questions. On the whole, the difficulty is medium to high, not particularly tricky, but very much a test of logical clarity. The design of the questions not only shows whether your foundation is solid, but also forces you to think about whether there is a better way to write, which is quite suitable for practicing thinking and brushing up.

Starbucks Interview Overview

Starbucks OA is generally divided into several sections:

  1. Programming questions (Python/Java/C++ optional): Logical, examining exception handling and implementation skills.
  2. algorithmic question: Understanding of arrays, sorting and optimization problems.
  3. May involve SQL or logical reasoning questions: Not exactly the same from batch to batch.

The number of questions was not particularly high, but time was tight and there was little room for error.

Starbucks Online Assessment 真题回忆

1. Python: Return or Raise ValueError

Implement a function multiply that takes 3 integer arguments. a, b, and bound.

  • If the result of multiplying a And b is less than or equal to bound, return the result.
  • Otherwise, raise a ValueError exception with the message.
    "multiplication of a and b with bound X not possible".

Constraints

  • 1 ≤ queries ≤ 1000
  • 1 ≤ a, b ≤ bound ≤ 10⁵

Sample Input

3
5 2 23
5 2 10
5 2 9

Sample Output

10
10
multiplication of 5 and 2 with bound 9 not possible

2. Element Swapping

You are given an array arr of n You may repeatedly choose an index I (0 ≤ i < n-1) and swap arr[i] with arr[i+1].
Constraint: Each element can be swapped at most once.

The strength of an index I is defined as (arr[i] * (i+1)).
Find the maximum possible sum of strengths of all indices after optimal swaps.

Example

n = 4
arr = [2, 1, 4, 3]

Optimal swaps: swap arr[0] & arr[1], swap arr[2] & arr[3].
Final array = [1, 2, 3, 4].
Sum = (1)1 + 22 + 33 + 44) = 30.

Sample Input

5
1
9
7
3
2

Sample Output

66

3. Coffee Orders Optimization

Problem Statement.
Starbucks wants to analyze its customers' coffee ordering patterns. You are given an array of strings representing the drinks ordered in sequence during a day. You are given an array of strings representing the drinks ordered in sequence during a day. Write a function to find the length of the longest subsequence where the same drink is ordered consecutively.

Example.

Input: ["Latte", "Latte", "Espresso", "Cappuccino", "Cappuccino", "Cappuccino", "Latte"]
Output: 3
Explanation: "Cappuccino" is ordered 3 times in a row, which is the longest streak.

Function Signature.

def longestDrinkStreak(orders: List[str]) -> int.

Constraints.

  • 1 ≤ len(orders) ≤ 10^5
  • Each string in orders consists of English letters only.

On the whole, Starbucks' OA is not only about basic questions, it focuses more on code specification, exception handling and optimization ideas. Many students have obviously brushed up on the questions, but because they didn't grasp the details (e.g., exception message format, exchange constraints), the final result was a little bit worse.

Programhelp helps you get OA easily

If you're preparing OA for companies like Starbucks, IBM, or Verisk, there's really no need to die alone.Programhelp can provide remote voice reminders, debug guidance and problem solving exercises, so that you can make less detours in the limited time to answer the questions and significantly increase the pass rate. Many students said that when they encountered a stuck point, as long as someone timely enlightenment, the idea immediately passes, and finally successfully get the OA.

author avatar
jor jor
END
 0
Comment(No Comment)