亚马逊最近疯狂发OA中,即将迎来大范围新的面试机会。
Amazon Web Services (AWS) has several processors for executing processes scheduled on its servers.
In order to maintain logical independence, a process is divided into segments. Each segment has two characteristics: the segment size (1 < segment size < 10^9), and a pointer to the next segment so
that the sequential order of execution is maintained within a process. Hence, this structure can be visualized as a linked list.
Given the segment structure of a process as a linked list, find the longest sub-list which has the segment sizes in non-increasing order. A sub-list of length 1 is always a valid sub-list. If there are multiple sub-lists of maximum length, return the sub-list which occurs earliest.
Note:
- A sublist is obtained by removing some nodes from the head and some nodes from the tail of the linked list.
- Solve the problem in constant extra space
Example
There are n = 5 segments with their segment sizes [2, 5, 4, 4, 5].
The longest non-increasing sub-list has 3 nodes:
Segment Size Segment Size Segment Size
一如既往的我们光速获得满分
OA代做服务,代面试服务,面试辅助服务等,我们均有提供。欢迎联系我。
If you're afraid that you can't solve the OA on your own, please scan the code to contact me or telegram