Pinterest logo

Pinterest Interview Questions

22 practice questions for Pinterest technical interviews

Pinterest software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. Article Ranking System


Category: String coding problem
Design an article ranking system for a news platform. The system stores articles identified by a unique integer ID, a relevance score, and a category...
Input: List
Output: Array
coding Medium Verified Question #2

2. Audit Log Analyzer


Category: Graph coding problem
Design an audit log analyzer for a financial transactions platform. The system is initialized with a list of log entries, where each entry is a...
Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #3

3. Compressed Grid Operations


Category: Matrix coding problem
Design a CompressedGrid class that stores a sparse integer matrix efficiently by keeping only non-zero values in memory. The class must support...
Input: Matrix (2D array)
Output: Computed result
coding Medium Verified Question #4

4. Coworking Desk Availability


Category: Interval-based coding problem
A co-working space manages desk reservations throughout the day. Given the space's operating hours, its total desk capacity, and a list of bookings,...
Input: List
Output: Array
coding Medium Verified Question #5

5. Degrees of Separation


Category: Algorithm coding problem
In a social network, there are n users numbered from 0 to n - 1. You are given a list of bidirectional friend connections connections, where...
Input: List
Output: Integer
coding Medium Verified Question #6

6. Directory Permission Manager


Category: Tree coding problem
Design a permission management system for a hierarchical file system. Implement the DirectoryPermissionManager class. The directory hierarchy is...
Input: List
Output: Computed result
coding Medium Verified Question #7

7. EV Charging Optimizer


Category: Binary search coding problem
An electric vehicle travels along a highway between a start and a destination. Charging stations are located at positions given in a non-decreasing...
Input: Array
Output: Computed result
coding Medium Verified Question #8

8. Game Level Tracker


Category: String coding problem
Design a leaderboard system for a mobile game where players progress through levels sequentially. Implement the GameLevelTracker class. The game...
Input: String
Output: Integer
coding Medium Verified Question #9

9. Maximum Meeting Schedule


Category: Algorithm coding problem
You manage a single conference room and have a list of meeting requests. Each meeting is defined by a [start, end] pair. Two meetings overlap if...
Input: List
Output: Integer
coding Medium Verified Question #10

10. Playlist Song Connection


Category: Graph coding problem
A music platform organizes songs into playlists. Each playlist contains a set of distinct song IDs, and a song may appear in multiple playlists. Two...
Input: Graph (nodes and edges)
Output: Integer
coding Medium Verified Question #11

11. Request Anomaly Linker


Category: Trie-based coding problem
You are building an anomaly detection system for a distributed platform. The system receives request logs and anomaly reports, and must link each...
Input: Array of strings
Output: Array
coding Hard Verified Question #12

12. Run Length Decode All


Category: Graph coding problem
A signal log is compressed using run-length encoding. In this scheme, a source string of digits is scanned left to right, and each run of identical...
Input: Graph (nodes and edges)
Output: Array
coding Medium Verified Question #13

13. Timed Job Queue


Category: Priority queue coding problem
Design a background job scheduling system called TimedJobQueue. The system accepts jobs with an associated delay and executes them in delay order....
Input: List
Output: Array
coding Medium Verified Question #14

14. Unordered Nested Equality


Category: String coding problem
Two configurations are considered equal if they contain the same elements regardless of order at every level of nesting. Elements can be atomic...
Input: List
Output: Computed result
coding Medium Verified Question #15

15. Warehouse Drone Dispatch


Category: String coding problem
A vertical warehouse uses autonomous drones to fulfill package requests. Each drone is at a specific floor and has one of three states:...
Input: List
Output: Integer
coding Medium Verified Question #16

16. Warehouse Item Counter


Category: Grid/matrix coding problem
You are building a warehouse inventory scanner that analyzes a 2D grid representing a warehouse floor. Each cell is either 'X' (part of an item) or...
Input: 2D grid
Output: Computed result
coding Medium dynamic programming #1

1. Dynamic Programming — Split Array for Largest Sum

Background: In Pinterest, handling user-generated content is critical to ensuring smooth performance. When grouping content into arrays based on collective engagement, it is important to optimize resource consumption during this process.
Problem statement: Given an array nums of non-negative integers, partition it into m non-empty contiguous subarrays. The task is to minimize the largest sum among these subarrays. For example, if nums = [7, 2, 5, 10, 8] and m = 2, the partitioning could be [7,2] and [5,10,8], resulting in a largest sum of 18.
Function/class signature:
  • def split_array(nums: List[int], m: int) -> int:


Example 1:
Input: nums = [7, 2, 5, 10, 8], m = 2
Output: 18
Explanation: One optimal solution is to split the array into [7,2] and [5,10,8]. The largest sum is 18.
Example 2:
Input: nums = [1, 4, 4], m = 3
Output: 4
Explanation: Split into [1], [4], [4], hence the largest sum is 4.
Constraints:
  • 1 <= nums.length <= 1000

  • 0 <= nums[i] <= 10^6

  • 1 <= m <= nums.length

coding Medium dynamic programming #2

2. Dynamic Programming — Reconstructing Flight Routes

Background: In Pinterest, users can save various travel ideas including destinations and routes. Efficiently organizing and reconstructing these routes from a set of unordered flight tickets is crucial for building features like travel boards.
Problem statement: You are given an array of tickets where each ticket is represented as a pair of strings ['Origin', 'Destination']. You need to reconstruct the itinerary in order of visits starting from 'JFK' and visiting each destination exactly once. The answer should be in lexicographically smallest order if there are multiple valid itineraries. Return the reconstructed itinerary as a list of strings.
Function/class signature:
  • def find_itinerary(tickets: List[List[str]]) -> List[str]:

Example 1: Input: [['MUC', 'LHR'], ['JFK', 'MUC'], ['SFO', 'SJC'], ['LHR', 'SFO']]
Output: ['JFK', 'MUC', 'LHR', 'SFO', 'SJC']
Explanation: Starting from 'JFK', the only path using all tickets is 'JFK' → 'MUC' → 'LHR' → 'SFO' → 'SJC'.
Example 2: Input: [['JFK', 'SFO'], ['JFK', 'ATL'], ['ATL', 'JFK'], ['SFO', 'ATL']]
Output: ['JFK', 'ATL', 'JFK', 'SFO']
Constraints:
  • 1 <= tickets.length <= 1000

  • Each ticket is a non-empty pair of strings with length <= 3

  • All Origin and Destination strings consist of uppercase English letters only.

coding Medium graph #3

3. [Graph] — Reconstruct routes from unordered travel tickets

Background: Pinterest enables users to share travel inspirations and itineraries through boards. When users share travel tickets, reconstructing the ordered trip route enhances usability and improves user experience.
Problem statement: You are given a list of tickets, where each ticket is a pair of departure and arrival airports represented as strings. The tickets may not be in any specific order. Your task is to reconstruct the itinerary in the order of travel. The itinerary must start from 'JFK'. Return a list of strings representing the route. If no such itinerary exists, return an empty list. Note that there may be multiple valid itineraries, but you should return the one that uses the smallest lexical order.
Function/class signature:
  • def findItinerary(tickets: List[List[str]]) -> List[str]:

Example 1:
  • Input: [['MUC', 'LHR'], ['JFK', 'MUC'], ['SFO', 'SJC'], ['LHR', 'SFO']]

  • Output: ['JFK', 'MUC', 'LHR', 'SFO', 'SJC']

  • Explanation: The route starts from JFK, and tickets are used in the order of their lexical order while ensuring all connected travel.

Example 2:
  • Input: [['JFK', 'SFO'], ['JFK', 'ATL'], ['ATL', 'JFK'], ['SFO', 'ATL']]

  • Output: ['JFK', 'ATL', 'JFK', 'SFO']

Constraints:
  • 1 <= len(tickets) <= 1000

  • Airports are represented by capital letters and can have up to 10 characters each.
coding Medium graph #4

4. Graph — Reconstruct Travel Routes

Background: Pinterest connects users through shared interests, and travel ideas often come from various sources. Reconstructing users' travel routes from unordered tickets can help provide enhanced recommendations and visualizations.
Problem statement: You are given a list of unordered travel tickets represented as pairs of departure and arrival airports. Your task is to reconstruct the itinerary based on the tickets and return it in order. You may assume that the provided tickets are such that there is exactly one valid itinerary without cycles. Use depth-first search to find the route. The resulting route must start from JFK.
Function/class signature:
  • def reconstruct_itinerary(tickets: List[List[str]]) -> List[str]:

Example 1:
  • Input: [['MUC', 'LHR'], ['JFK', 'MUC'], ['SFO', 'SJC'], ['LHR', 'SFO']]

  • Output: ['JFK', 'MUC', 'LHR', 'SFO', 'SJC']

  • Explanation: The valid order of tickets represents the reconstructed route starting from JFK and ensuring all tickets are used.

Example 2:
  • Input: [['JFK', 'SFO'], ['JFK', 'ATL'], ['ATL', 'JFK'], ['SFO', 'ATL']]

  • Output: ['JFK', 'ATL', 'JFK', 'SFO']

  • Explanation: The route allows to return to JFK from ATL using available tickets.

Constraints:
  • 1 <= len(tickets) <= 1000

  • Each ticket is represented by a pair of strings: from and to airport codes.

  • Each airport code consists of 3 uppercase letters.
coding Medium graph #5

5. [Graph] — Reconstruct Route from Unordered Travel Tickets

Background: Pinterest often encourages travel and exploration of interests through its platform. Efficient route mapping can enhance user experiences related to travel pins and recommendations.
Problem statement: Given a list of unordered travel tickets represented as pairs of strings, where each pair (from, to) indicates a direct ticket from from to to, reconstruct the route in the correct order starting from the initial city. You must return a list of cities in the correct order.
Function/class signature:
  • def reconstruct_ticket(tickets: List[Tuple[str, str]]) -> List[str]:


Example 1:
Input: tickets = [("MUC", "LHR"), ("JFK", "MUC"), ("SFO", "SJC"), ("LHR", "SFO")]
Output: ['JFK', 'MUC', 'LHR', 'SFO', 'SJC']
Explanation: The correct route starts from JFK and goes through MUC, LHR, SFO, and ends with SJC.
Example 2:
Input: tickets = [("JFK", "ATL"), ("ATL", "JFK"), ("JFK", "SFO")]
Output: ['JFK', 'ATL', 'JFK', 'SFO']
Explanation: The route starts at JFK, goes to ATL, returns to JFK, and finally goes to SFO.
Constraints:
  • 1 ≤ tickets.length ≤ 1000

  • The from and to strings are guaranteed to be non-empty and contain only English letters.

  • Each ticket appears at most once in the tickets list.
coding Medium dynamic programming #6

6. Dynamic Programming — Longest Increasing Subsequence

Background: In Pinterest's visual discovery platform, users can curate and search through a vast number of images, each representing various interests. A feature to suggest the most relevant trends or categories could greatly enhance user engagement. Finding the longest increasing subsequence of interests can help in generating recommended content.
Problem statement: Given an array of integers representing user interests, where each integer corresponds to a unique identifier for an interest, your task is to find the length of the longest increasing subsequence of these interests. The interests can be thought of as items in a feed whose engagement counts are being tracked.
Function/class signature:
  • def longest_increasing_subsequence(interests: List[int]) -> int:

Example 1:
Input: [10, 5, 20, 30, 15]
Output: 3
Explanation: The longest increasing subsequence is [10, 20, 30].
Example 2:
Input: [3, 10, 2, 1, 20]
Output: 3
Explanation: The longest increasing subsequence is [3, 10, 20].
Constraints:
  • 1 <= len(interests) <= 1000

  • -10^6 <= interests[i] <= 10^6

Start practicing Pinterest questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free