注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
本帖最后由 一只卷毛猫 于 2022-9-3 22:53 编辑
总结了一下citadel 的oa题目,我抽到的题都在期中,求加米!
1. Sprint Training (力口伞气领)**
Imagine there are n points along a straight trail, while a runner run sprints of intervals between those point.The training plan is an array a[], which implies the runner should run from point a to point a[i+1].
`For example, given n = 10, a = [2, 4, 1, 2].
The runner should run from point 2 to point 4,
then turn back from point 4 to point 1,
and then from point 1 to point 2.`
Find the point that visited the most by runner after he finished training, i.e. in above example, point 2 is the most visited.If more than one point are visited the most, find the point with minimum index.
2. visiting cities
[img]https://s3.us-west-2.amazonaws.com/secure.notion-static.com/1c4b4d42-1370-4352-8d33-c5d6bfd068c3/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220904%2Fus-
**So you need to compute the odd count**
even ^ any number = even
odd ^ any number =odd
even * even = even
odd * odd = odd
5. Shrink Number Line (俐抠久要林)
6. Subarray sum divisible by k(俐抠久起司)
7. longest subarray with sum <= k 滑动窗口
8. Do the belong
Given three corner points of a triangle, and one more point P. Write a function to check whether P lies within the triangle or not.
For example, consider the following program, the function should return true for P(10, 15) and false for P'(30, 15)[/i] |