Amazon计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(95)
OOD(4)
Algorithm(78)
System Design(10)
高频题(0)
Math(0)
全部(95)
OOD(4)
Algorithm(78)
System Design(10)
高频题(0)
Math(0)
1.arraylist
2.implement linked list
3.Find Kth Smallest Pair Distance in Array
4.Basic Calculator Implementation Without Eval Function
5.Minimum Number of Conference Rooms Required
6.Integer to Roman Numeral Conversion
7.Conway's Game of Life: Next State Calculation
8.Top K Frequent Words in Array
9.Return k-1 distinct characters
10.The heaviest goods
11.Location of downbell
12.Return the next letter
13.API return
14.Number of categories
15.Distance K Nodes in Binary Tree
16.remove k elements
17.Merge Intervals
18.Merging Two Sorted Linked Lists
19.Counting Primes Less Than N
20.Finding Peak Element in an Array with Binary Search
21.Minimum Buses to Reach Destination
22.Course Schedule II
23.Minimum Cost to Connect Sticks
24.mininum swaps
25.Degian a Car Radio System
26.Total imbalance
27.Find the number of ways to select pages
28.Binary Tree Level Order Traversal II
29.Binary Tree Level Order Traversal
30.Unique Permutations of a Number Collection with Duplicates
31.最少搬运次数
32.Merge k Sorted Linked Lists
33."Find User Website Visit Pattern with Highest Score"
34.Binary Tree Level Order Traversal II
35.Answered subject
36.Warehouse
37.Sum of similarities of string
38.Minimum Path Sum
39.Maze
40.Day change(cell growth)
41.Binary search tree minimum sum from root to leaf
42.Shorted job first
43.Loop in linked list
44.Insert into cycle linked listt
45.Rotate Matrix
46.Round Robin
47.LRU Cache count miss
48.Greatest Common Divisor
49.Window sum
50.Overlap Rectangle
51.Find K Nearest Point
52.Two Sum
53.Subtree
54.Reverse second half of linked list
55.Merge Two list
56.Longest palindromic substring
57.Valid parenthesis
58.Percentile
59.Linux command
60.Locker
61.Collection of expressions
62.Publishing-substrings count
63.Find array size
64.Max Frequency Element with K Increments
65.Longest Palindromic Substring in a String
66.What technologies can handle a large number of requests and how would you implement them?
67.Explain the space and time complexity of using an unordered map in your solution.
68.Longest Match in a String with Wildcard
69.getMinDistance Algorithm
70.System Design for Detecting Damaged Goods in a Warehouse
71.LeetCode 767
72.Maximum Number of Balanced Shipments
73.Find All Anagrams in a String
74.Find all paths in a tree that sum to a given value
75.Cache and Storage Management in Operating Systems
76.Dictionary Operations Time Complexity
77.Binary Search Time Complexity
78.Search for a string in all files under a UNIX directory
79.Implement an LRU Cache
80.Implement the 'Plant Flowers' algorithm.
81.Validate and optimize a Sudoku solver
82.Design a Tic-Tac-Toe game
83.Design a Book class with character index
84.Print the top view of a tree
85.Implement n-way cache
86.Coding Problem: LeetCode 113 - Path Sum II
87.Design a Text Editor
88.Merge Overlapping Intervals
89.Data Structure Comparison
90.Python Basic Usage
91.Coding Problem: Most Common Letters in Queues
92.Write a function to determine if it's possible to travel from one point to another in a 2D boolean array using BFS/DFS.
93.Explain the differences between C and Python.
94.Filter Pattern and Chain of Responsibilities
95.Implement a Web Crawler
1. arraylist
给一个arraylist<int>你可以对这个array的某一个range的数加一个数值,然后使得这个array变成一个连续上升的array(也可以等于)也就是说array[i]>=array[i-1]return每次操作的加数的和,使得这个和最小
比如[3,4,1,6,2]变成[3.4.4.9.5]然后加4变成[3.4.4.9.9]这样return7就好,当然你也可以在array[2]加3然后array[4]加4这样操作结果也是7
eg2.[3,2,1] return 2            eg 3[3,5,2,3] return 3
2. implement linked list
给你一个链表,以及一个list,list里面每个元素长度为2,第一个是当前的操作,共有三种,push head,push tail,pop head.第二个是假如操作是要push进链表,所需Push进去Node的值,要求在O(1)的空间完成
3. Find Kth Smallest Pair Distance in Array
The distance of a pair of integers a and b is defined as the absolute difference between a and b.

Given an integer array nums and an integer k, return the kth smallest distance among all the pairs nums[i] and nums[j] where 0 <= i < j < nums.length.

 

Example 1:

Input: nums = [1,3,1], k = 1
Output: 0
Explanation: Here are all the pairs:
(1,3) -> 2
(1,1) -> 0
(3,1) -> 2
Then the 1st smallest distance pair is (1,1), and its distance is 0.

Example 2:

Input: nums = [1,1,1], k = 2
Output: 0

Example 3:

Input: nums = [1,6,1], k = 3
Output: 5

 

Constraints:

  • n == nums.length
  • 2 <= n <= 104
  • 0 <= nums[i] <= 106
  • 1 <= k <= n * (n - 1) / 2
4. Basic Calculator Implementation Without Eval Function
Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.

Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as eval().

 

Example 1:

Input: s = "1 + 1"
Output: 2

Example 2:

Input: s = " 2-1 + 2 "
Output: 3

Example 3:

Input: s = "(1+(4+5+2)-3)+(6+8)"
Output: 23

 

Constraints:

  • 1 <= s.length <= 3 * 105
  • s consists of digits, '+', '-', '(', ')', and ' '.
  • s represents a valid expression.
  • '+' is not used as a unary operation (i.e., "+1" and "+(2 + 3)" is invalid).
  • '-' could be used as a unary operation (i.e., "-1" and "-(2 + 3)" is valid).
  • There will be no two consecutive operators in the input.
  • Every number and running calculation will fit in a signed 32-bit integer.
5. Minimum Number of Conference Rooms Required
Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required.

 

Example 1:

Input: intervals = [[0,30],[5,10],[15,20]]
Output: 2

Example 2:

Input: intervals = [[7,10],[2,4]]
Output: 1

 

Constraints:

  • 1 <= intervals.length <= 104
  • 0 <= starti < endi <= 106

follow up :输出类似每节课对应哪个room.