Interview Round DistributionClick any round below to filter
Topics:
Showing 20 of 101 results for Tumblr Inc.Page 1 of 6
Coding
48
Validate if a given tree is a valid binary search tree.
Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key, and the right subtree contains only nodes with keys greater than the node's key…
Search a 2D matrix where each row and column is sorted.
Write an efficient algorithm that searches for a value target in an m x n integer matrix. Integers in each row are sorted, and the first integer of each row is greater than the last integer of the previous row.
Input: matrix = [[1,4],[2,5]], target = 20
Output: FALSE
Explanation:…
Find the longest increasing path in a matrix.
Given an m x n integers matrix, return the length of the longest strictly increasing path in the matrix. From each cell, you can either move in four directions: left, right, up, or down.
Input: matrix = [[1,2],[3,4]]
Output: 3
Explanation: The longest strictly increasing path is 1 -> 3 ->…
Implement a Trie
Implement a Trie for prefix matching.
Input: insert("hello"), startsWith("hel")
Output: TRUE
Explanation: Traverses the Trie nodes to confirm that the prefix "hel" actively exists within the inserted word "hello".
Optimal Meeting Point
Calculate the optimal meeting point for multiple people on a 2D grid.
Input: grid = [[1,0],[0,1]]
Output: 2
Explanation: The optimal meeting point is either (0,1) or (1,0), requiring exactly 1 step from each person resulting in a total distance of 2.
Find the majority element in an array.
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
Input: nums = [3, 2, 3]
Output: 3
Explanation: The number 3 appears 2 times, which is strictly greate…
Connected Components in an Undirected Graph
Determine the number of connected components in an undirected graph.
Input: n = 4, edges = [[0,1],[2,3]]
Output: 2
Explanation: The graph is split completely evenly into two distinct isolated components: nodes {0,1} and nodes {2,3}.