CS-OA cs-vo Faang

PayPal面经-PayPal VO真题-PayPal VO real questions-PayPal interview

PayPal的面试流程非常的标准,和FAANG大厂十分的接近,都是45分钟要两道算法题,其中算法题非常的easy,我们将花费大量时间在第二道coding题目上,以下是真实面试中出现的coding题目。


PayPal's interview process is very standard, very close to that of the FAANG companies. It requires two algorithm questions in 45 minutes. The algorithm question is very easy. We will spend a lot of time on the second coding question. The following is a real interview Coding questions that appear in .

Cache Queries

Description

Implement a prototype of a simple cache query handler.

There are n data entries stored in the cache. Each entry is of the form {timestamp, key, value}, where timestamp represents the time at which the entry was stored in the cache, key represents the ID assigned to the cache entry, and value represents the data value of the entry, an integer represented as a string. The keys assigned to the cache entries may not be unique. The cache query handler receives q query requests, where each query is of the form {key, timestamp}, where key represents the ID of the cache entry to find, and timestamp represents the time the entry was added.

Given two 2D arrays of strings, cache_entries, and queries, of sizes n x 3 and q x 2 respectively, return an array of size q with the data values for each query.

Example

cache_entries = [["12:30:22", "a2er5i80", "125"], ["09:07:47", "i0o9ju56", "341"], ["01:23:09", "a2er5i80", "764"]] queries = [["a2er5i80", "01:23:09"], ["i0o9ju56", "09:07:47"]]

  • queries[0] corresponds to the data entry at index 2, with value = "764"
  • queries[1] corresponds to the data entry at index 1, with value = "341"
Event TypeDataCacheQuery Result
Update cache["09:07:47", "i0o9ju56", "341"]i0o9ju56 = 341-
Query["i0o9ju56", "09:07:47"]i0o9ju56 = 341341
Update["12:30:22", "a2er5i80", "125"]i0o9ju56 = 341, a2er5i80 = 125-
Update Cache["01:23:09", "a2er5i80", "764"]i0o9ju56 = 341, a2er5i80 = 764-
Query["a2er5i80", "01:23:09"]i0o9ju56 = 341, a2er5i80 = 764764

Return [764, 341].

首先,我仔细阅读了题目描述,确保我完全理解了题目的要求。这包括理解缓存的数据结构、查询的格式以及最终期望的输出。在这个问题中,我注意到我们需要处理两个数组:cache_entries(缓存条目)和queries(查询)。

First, I read the question description carefully to make sure I fully understood what the question required. This includes understanding the cached data structure, the format of the query, and ultimately the desired output. In this question, I noticed that we need to deal with two arrays: cache_entries (cache entries) and queries (queries).

其次,我编写了一个算法来填充这个哈希映射,然后对于每个查询,我会构造出它的唯一标识符,并在哈希映射中查找以获取数据值。如果在映射中找不到对应的键,我将返回一个特定的错误代码或空值。

Second, I wrote an algorithm to populate this hash map, and then for each query, I constructed its unique identifier and looked up in the hash map to get the data value. If the corresponding key is not found in the map, I will return a specific error code or a null value.

在向面试官展示我的解决方案之前,确保考虑了多方面的问题,并能够清晰地阐述我的解决方案。

Before presenting my solution to the interviewer, make sure I consider multiple aspects of the problem and be able to articulate my solution clearly.

求职上岸绝不是一朝一夕之功,低年级同学想要拥有一份大厂实习经历,需要大家提前做好充足的准备。

【Go】了解求职服务,全面提升求职竞争力!

We can provide special services such as interview assistance and proxy interviews as needed to help you secure your offer

Finding a job is not something that can be achieved overnight. If younger students want to have an internship experience in a large company, they need to make sufficient preparations in advance.

【 Go 】 Learn about job search services and comprehensively enhance your job search competitiveness!

Leave a Reply

Your email address will not be published. Required fields are marked *