How would you create a geometry benchmark? Describe the chain from idea to final dataset.
Data Analyst
val_a, val_b = 0, 0 t = None while i < len(a) or j < len(b): a_next = a[i][0] if i < len(a) else float('inf') b_next = b[j][0] if j < len(b) else float('inf') if a_next < b_next: val_a = a[i][1] t = a[i][0] i += 1 elif b_next < a_next: val_b = b[j][1] t = b[j][0] j += 1 else: val_a = a[i][1] val_b = b[j][1] t = a[i][0] i += 1 j += 1 result.append((t, val_a + val_b)) return result
Afanasy had been working for 2 weeks on writing code capable of solving Japanese crossword puzzles with support for nine colors, when at a team meeting, a colleague told him that he could handle the task faster himself, and there was no point in the program anymore. But Afanasy, being an optimist, decided to continue practicing this task and do the following — estimate how well his colleague handles crosswords. For this assessment, he chose an analog of the IoU metric — the calculation will be similar to the classic Intersection Over Union, but by colors. It works as follows: each matching cell in the original and the solution by color adds 1 to the numerator, and in the denominator, 1 is added for each cell in the original and the solution (for matching cells, only one is added). After that, averaging is performed over the number of colors in the original image, rounded to two decimal places; zero is not considered a color, so the metric should not be calculated for cells of this color. Input starts with a line containing the number of rows n and columns m (in that order). Then, 2n lines follow, containing m numbers separated by spaces — the first n lines relate to the submitted crossword, and the next n — to the original image. It is assumed that each line, starting from the second, contains exactly m numbers. As an answer, output a number rounded to two decimal places, as in the examples. Here are some examples: 1. First example [phone] -> 1.0 Explanation: the contribution of matching and non-matching cells (1.0 + 1.0 + 1.0 + 1.0) / number of colors (4) 2. Second example [phone] -> 0.08 Explanation: the contribution of matching and non-matching cells (0.25 + 0.0 + 0.0) / number of colors (3); zeros are not counted, neither as cells in representations nor in the number of colors. 3. Third example [phone] where the submitted image starts [phone] — where the submitted image ends 0 1 2 — where the original image begins [phone] -> 0.47 Explanation: the contribution of matching and non-matching cells (0.4 + 0.5 + 0.5) / number of colors (3); zeros are not counted as cells in representations nor in the number of colors. 4. Fourth example [phone] -> 0.0 Explanation: the contribution of matching and non-matching cells (0.0) / number of colors (1); zeros are not counted as cells in representations nor in the number of colors.
Write Python code that computes the dot product of two RLE-compressed vectors in a single pass.
What is the name of the sorting operator in SQL and when is it executed? Where is LIMIT in the order of execution?
What is the logical order of execution for FROM, JOIN, GROUP BY, and SELECT in this SQL query?
Explain the logic of solving the sum_series problem: how to construct the sum of two stepwise time series?
Псевдокод sum_series(a={{1, 2}, {5, 1}}, b={{2, 4}, {3, 6}, {9, 7}}) -> {{1, 2}, {2, 6}, {3, 8}, {5, 7}, {9, 8}} def sum_series(a, b): result = [] i , j = 0, 0 val_a, val_b = 0, 0 while i < len(a) or j < len(b): a_next = a[i][0] if i < len(a) else float('inf') b_next = b[j][0] if i < len(b) else float('inf') if a_next <= b_next: val_a = a[i][1] t = a[i][0] i += 1 else: val_b = b[j][1] t = b[j][0] j += 1 result.append((t, val_a + val_b)) return result
How would you set up an A/B test to evaluate a new search algorithm? How to determine the required sample size and test duration?
B. Prefixes and Suffixes Given a sorted array of n zeros. At each step, you can choose an arbitrary number of the first or last elements of this array, and add one to all selected elements. Is it possible to reach the specified state of the array after some number of such operations? Input format The first line contains an integer 1 ≤ n ≤ 100000 — the number of elements in the array. The second line contains n non-negative integers a1, a2, ..., an separated by spaces, where ai ≤ 10^18 — the desired final elements. Output format Print "YES" if such a state is achievable, and "NO" if it is not. Example Input [phone] Output YES Note The states [phone] can be reached as follows: add one to the first three elements, resulting in [phone] add one to the last four elements, resulting in [phone] add one to the last element, resulting in [phone]
How do you collect ground truth answers for a geometry benchmark?
-- Regarding the promo campaigns sent to users: -- 2.1 Write a query that outputs the number of users who successfully received communication for each campaign. -- 2.2 Modify the query to output: the number of users who did not receive any successful communication at all, for each campaign? -- 3. An additional field – event_timestamp – has been added to the communications table, representing the date and time of the communication delivery event in the format '%Y-%m-%d %H:%M:%S'. -- For all campaigns, including those not launched, calculate the metric: the proportion of users for whom the delivery of a successful message was achieved on the first attempt. -- You can use window functions, or do without them, but it is important to write the query efficiently.
List the criteria that data must meet to have a normal distribution.
Do you have any questions for the interviewer?
Псевдокод sum_series(a={{1, 2}, {5, 1}}, b={{2, 4}, {3, 6}, {9, 7}}) -> {{1, 2}, {2, 6}, {3, 8}, {5, 7}, {9, 8}} def sum_series(a, b): result = [] i , j = 0, 0 val_a, val_b = 0, 0 while i < len(a) or j < len(b): a_next = a[i][0] if i < len(a) else float('inf') b_next = b[j][0] if j < len(b) else float('inf') if a_next < b_next: val_a = a[i][1] t = a[i][0] i += 1 else: val_b = b[j][1] t = b[j][0] j += 1 result.append((t, val_a + val_b)) return result
What is a benchmark and how would you evaluate the quality of a multimodal model?
-- Marketers launch promo campaigns in the service application. There are two tables: -- campaigns – list of campaigns -- - campaign – campaign name -- - action_type – campaign type: "push" or "banner" -- communications – backend log of communications sent to users for these campaigns -- - user_id – user identifier -- - campaign – campaign name -- - status – event status: "success" or "error" --------------------------------------------------------------------------- -- 1. Initially, the campaigns table has 4 rows: -- | campaign | action_type | -- |-------------|-------------| -- | promo_dogs | push | <- randomly duplicated -- | promo_cats | banner | -- | promo_cats | banner | <- two rows -- | promo_rats | push | -- It is also known that: -- campaigns promo_dogs and promo_cats were successfully conducted on 100 users each, and each user received one communication, -- while promo_rats is only planned. -- 1.1 What will the query output: SELECT campaign, COUNT(*) as rows, COUNT(DISTINCT co.user_id) AS users FROM campaigns AS ca INNER JOIN communications AS co ON ca.campaign = co.campaign GROUP BY ca.campaign -- 1.2 How will the answer change if the JOIN type is changed to LEFT?
Will the stock returns be normally distributed? (minute-by-minute price increases from 2000 to 2026)?
D. Chinese fireworks Vladimir bought a set of 3 Chinese fireworks. They look exactly the same and are mixed in a box, but according to the instructions, they have different reliability: 1. "Elite" — defect rate 10% (success probability 0.9). 2. "Standard" — defect rate 20% (success probability 0.8). 3. "Economy" — defect rate 40% (success probability 0.6). Vladimir randomly takes the first firework, lights it, and it successfully fires. Happy, Vladimir decides to launch the remaining two fireworks one after another. What is the probability that both the second and third fireworks will also successfully fire — without defect? Round the answer to three decimal places. Output format A decimal number rounded to 3 decimal places. For example, 0.98 or 0.999
-- 2. The campaigns table has been fixed: duplicate entries removed, a primary key (PK) added. -- More campaigns have been conducted, and due to bugs, users started experiencing failed delivery attempts, and some couldn't see the message at all. -- Regarding the promotional campaigns sent to users: -- 2.1 Write a query that outputs the number of users who successfully received the communication for each campaign. -- 2.2 Modify the query to output: the number of users who did not receive any successful communication at all, for each campaign. -- 3. An additional field – event_timestamp – has been added to the communications table, representing the date and time of the communication delivery event in the format '%Y-%m-%d %H:%M:%S'. -- For all campaigns, including those not launched, calculate the metric: the proportion of users for whom the delivery of a successful message was achieved on the first attempt. -- You can use window functions, or do without them, but it is important to write an optimal query.