<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KVGHS6G" height="0" width="0" style="display:none;visibility:hidden"></iframe>

Pinterest计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(30)
OOD(2)
Algorithm(20)
System Design(8)
高频题(0)
Math(0)
全部(30)
OOD(2)
Algorithm(20)
System Design(8)
高频题(0)
Math(0)
1.Count and Say Sequence Algorithm
2.Employee Free Time Calculation
3.Merchant Product Information Update Service
4.Type-Ahead Service System Design
5.Escape Room Progress Tracking System
6.Design a system to calculate the sum of a very large dataset
7.Expression Evaluation with Additional Operations
8.Optimizing Expression Evaluation for Positive Integers
9.Expression Evaluation with Precedence
10.Simple Expression Evaluation
11.Coding Problems
12.Compare Nested Lists
13.String Compression Algorithm
14.Design Home Feed System
15.Dynamic Programming Problem
16.Reverse a Specific Problem
17.Wait Time Problem
18.Object-Oriented Design for a Modified Linked List
19.Design an Offline Signal Publishing & Serving System
20.Design a Rate Limiter
21.Handling Stream Input for Employee Free Time Problem
22.Minimum Number of Integers to Form Target Sum
23.Algorithm to Ensure Non-Adjacent Elements Are Not the Same
24.Expression Evaluation with Operator Precedence
25.Evaluate Expression to Target
26.Monitor Screen Pins Arrangement
27.What is your most proud project?
28.Implement a Trie
29.Combination of Operations to Reach Target
30.Count Unique Objects in 2D Array
1. Count and Say Sequence Algorithm
The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

  • countAndSay(1) = "1"
  • countAndSay(n) is the way you would "say" the digit string from countAndSay(n-1), which is then converted into a different digit string.
To determine how you "say" a digit string, split it into the minimal number of substrings such that each substring contains exactly one unique digit. Then for each substring, say the number of digits, then say the digit. Finally, concatenate every said digit.

For example, the saying and conversion for digit string "3322251":

Given a positive integer n, return the nth term of the count-and-say sequence.

 

Example 1:

Input: n = 1
Output: "1"
Explanation: This is the base case.

Example 2:

Input: n = 4
Output: "1211"
Explanation:
countAndSay(1) = "1"
countAndSay(2) = say "1" = one 1 = "11"
countAndSay(3) = say "11" = two 1's = "21"
countAndSay(4) = say "21" = one 2 + one 1 = "12" + "11" = "1211"

 

Constraints:

  • 1 <= n <= 30
2. Employee Free Time Calculation
 We are given a list schedule of employees, which represents the working time for each employee.

Each employee has a list of non-overlapping Intervals, and these intervals are in sorted order.

Return the list of finite intervals representing common, positive-length free time for all employees, also in sorted order.

(Even though we are representing Intervals in the form [x, y], the objects inside are Intervals, not lists or arrays. For example, schedule[0][0].start = 1, schedule[0][0].end = 2, and schedule[0][0][0] is not defined).  Also, we wouldn't include intervals like [5, 5] in our answer, as they have zero length.

 

Example 1:

Input: schedule = [[[1,2],[5,6]],[[1,3]],[[4,10]]] 
Output: [[3,4]] 
Explanation: There are a total of three employees, and all common free time intervals would be [-inf, 1], [3, 4], [10, inf]. We discard any intervals that contain inf as they aren't finite. 

Example 2:

Input: schedule = [[[1,3],[6,7]],[[2,4]],[[2,5],[9,12]]] 
Output: [[5,6],[7,9]] 

 

Constraints:

1 <= schedule.length , schedule[i].length <= 50

0 <= schedule[i].start < schedule[i].end <= 10^8
3. Merchant Product Information Update Service
Design a system that allows merchants to update product information with support for single and batch requests. The system should provide feedback on whether the product updates were successful. Product information may include image, price, and link. Additionally, design a service for other teams within the company to view existing products, such as viewing all products below a certain price.
4. Type-Ahead Service System Design
Design a type-ahead service for auto-fill search functionality.
5. Escape Room Progress Tracking System
Design a system to track the progress of players in an escape room game where multiple players enter the same room, which contains multiple chambers representing different levels. Implement two functionalities: 1. Player movement: allowing a player to move to the next chamber. 2. Viewing the current top K players.