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

Ebay计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(90)
OOD(4)
Algorithm(66)
System Design(10)
高频题(0)
Math(1)
全部(90)
OOD(4)
Algorithm(66)
System Design(10)
高频题(0)
Math(1)
1.Coin Change Problem
2.Course Schedule II
3.Grouping Anagrams from a List of Strings
4.Unique Binary Search Trees Count
5.Validating Binary Search Tree
6."Finding Maximum Depth of a Binary Tree"
7.HasPathSum in Binary Tree
8.Search 2D Matrix
9.Finding the Lowest Common Ancestor of Two Nodes in a Binary Tree
10.Binary Tree Level Order Traversal
11.Finding the Lowest Common Ancestor in a Binary Search Tree
12.Search in Rotated Sorted Array
13.Wildcard Pattern Matching Algorithm
14.Matrix
15.Interval overlapping
16.Best Time to Buy and Sell Stock
17.‌‌‌‌‍‍‍‍‍‌‌‌‌‍‍‌‍Event Emitter
18.Fit With Cell Replacement
19.Reduce The Number
20.三角形水杯乘酒的问题
21.Rotating a Box and Simulating Gravity
22.Matrix Queries
23.New Text Editor
24."Remove Anagrams and Convert Binary Search Tree to Sorted Doubly Linked List"
25.Remove Duplicates from Sorted Array
26.光线覆盖问题
27.Distinct Pairs with Digits Differing by 1
28.Implement Matrix Operations
29.Placing Obstacles on an Infinite Line
30.Asteroid Collision Problem
31.Building a Functional Ads Platform
32.Designing an Ads Platform
33.Browser URL Processing
34.Implementing 'classList' functionality using ES6
35.Design a Ticket Selling System
36.Fibonacci Number Optimization
37.Optimizing Search Engine Relevance
38.Serialize and Deserialize Binary Tree
39.C++ Profiling Tools
40.System Design for Finding Top K Similar Vectors
41.Simple Coding with Binary Search Follow-up
42.System Design - WebSocket vs Long Polling
43.Math Problem Related to Finding Common Multiples
44.Optimization of String Transformation
45.Pattern Matching in a Dictionary of Words
46.Handling Stream Input for a Coding Problem
47.Calendar Meeting Scheduling
48.System Design for a TinyURL Service
49.Longest Substring Without Repeating Characters
50.Topological Sorting of Course Schedule
51.Count Islands in a Grid
52.Object-Oriented Design of a Shopping Cart
53.Design a Hash Map
54.Algorithm and Complexity Analysis Interview Question
55.Inheritance and Encapsulation Interview Question
56.Multithread and OOD Interview Question
57.Minimum Dial Turns to Reach New Time
58.Generate All Substrings of a String
59.System Design for an eBay Notification System
60.Climbing Stairs Problem
61.Convert a Linked List to a Binary Tree
62.Merge K Sorted Lists
63.Merge Intervals
64.String Skeleton Match
65.Game Winner Prediction
66.Boolean Expression Evaluation
67.Binary String Operations
68.Convert Snake Case to Camel Case
69.Ranking Players Based on Points and Score Differences
70.Find the Index of the First Local Minimum in an Array
71.Stone Game Variant
72.Array Transformation Algorithm
73.Circular Storage Operations
74.Street Light Coverage Problem
75.String Addition and Concatenation
76.Longest Subarray with Absolute Difference Constraint
77.Matrix Division to Minimize Max-Min Value Difference
78.Cyclic X-Shift Array to Reverse-Sorted Array
79.Longest Subarray with Limited Difference
80.Matrix Division to Minimize Maximal and Minimal Value Difference
81.Cyclic X-Shift Array
82.Rectangles Fit in a Large Rectangle
83.Building Houses at Specific Indices with Constraints
84.Circular Storage with a Starting Index
85.Word Formation from Characters with Hyphens
86.Find Elements Greater Than Neighbors in an Array
87.Binary String Operations
88.Convert Snake Case to Camel Case in Quoted Strings
89.Sum of First Positive Numbers and Subsequent Operations
90.Find Elements Greater Than Neighbors
1. Coin Change Problem
You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.

Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.

You may assume that you have an infinite number of each kind of coin.

 

Example 1:

Input: coins = [1,2,5], amount = 11
Output: 3
Explanation: 11 = 5 + 5 + 1

Example 2:

Input: coins = [2], amount = 3
Output: -1

Example 3:

Input: coins = [1], amount = 0
Output: 0

 

Constraints:

  • 1 <= coins.length <= 12
  • 1 <= coins[i] <= 231 - 1
  • 0 <= amount <= 104
2. Course Schedule II
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai.

  • For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1.
Return the ordering of courses you should take to finish all courses. If there are many valid answers, return any of them. If it is impossible to finish all courses, return an empty array.

 

Example 1:

Input: numCourses = 2, prerequisites = [[1,0]]
Output: [0,1]
Explanation: There are a total of 2 courses to take. 
To take course 1 you should have finished course 0. So the correct course order is [0,1].

Example 2:

Input: numCourses = 4, prerequisites = [[1,0],[2,0],[3,1],[3,2]]
Output: [0,2,1,3]
Explanation: There are a total of 4 courses to take. To take course 3 you should have finished both courses 1 and 2.
Both courses 1 and 2 should be taken after you finished course 0.
So one correct course order is [0,1,2,3]. Another correct ordering is [0,2,1,3].

Example 3:

Input: numCourses = 1, prerequisites = []
Output: [0]

 

Constraints:

  • 1 <= numCourses <= 2000
  • 0 <= prerequisites.length <= numCourses * (numCourses - 1)
  • prerequisites[i].length == 2
  • 0 <= ai, bi < numCourses
  • ai != bi
  • All the pairs [ai, bi] are distinct.
3. Grouping Anagrams from a List of Strings
Given an array of strings strs, group the anagrams together. You can return the answer in any order.

An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

 

Example 1:

Input: strs = ["eat","tea","tan","ate","nat","bat"]
Output: [["bat"],["nat","tan"],["ate","eat","tea"]]

Example 2:

Input: strs = [""]
Output: [[""]]

Example 3:

Input: strs = ["a"]
Output: [["a"]]

 

Constraints:

  • 1 <= strs.length <= 104
  • 0 <= strs[i].length <= 100
  • strs[i] consists of lowercase English letters.
4. Unique Binary Search Trees Count
给你一个整数 n ,求恰由 n 个节点组成且节点值从 1 到 n 互不相同的 二叉搜索树 有多少种?返回满足题意的二叉搜索树的种数。

 

示例 1:


输入:n = 3
输出:5
示例 2:

输入:n = 1
输出:1
 

提示:
1 <= n <= 19
5. Validating 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.
  • The right subtree of a node contains only nodes with keys greater than the node's key.
  • Both the left and right subtrees must also be binary search trees.
 

Example 1:

Input: root = [2,1,3]
Output: true

Example 2:

Input: root = [5,1,4,null,null,3,6]
Output: false
Explanation: The root node's value is 5 but its right child's value is 4.

 

Constraints:

  • The number of nodes in the tree is in the range [1, 104].
  • -231 <= Node.val <= 231 - 1