Given a list of int, return the number of int where:
- Contains at least two '7'.
- Can be divided by 3.
- Example: 777 or 771.
Given a text (a list of strings/lines), output the branch name with most unique files (guarantee no tie).
Example:
switch branch1
push file1
push file2
switch branch 2
push file1
push file2
- Parse the text into a dictionary:
{branch_name: a set of unique file names}
Input a 2D matrix of a terrain and a starting coordinate (row idx, col idx) of water to flood the area, output a matrix of the same size of the "time" when each spot gets wet.
- Approach:
- BFS, layer by layer diffuse out.
- Increment time (
time++
) in the while loop. - Deduplicate the BFS queue.
In a distant universe, there exists a planet entirely covered in crystals with vibrant energy.
Problem:
You are presented with a list of integer pairs called centers
, where each pair represents the coordinates of a crystal on this planet. Each crystal projects a field of influence forming a square area around itself with sides measuring 2 units. Two crystal fields are said to intersect if they share at least one point.
Determine how many pairs of crystals have overlapping fields.
Example:
- Input:
centers = [[1, 1], [2, 2], [0, 4]]
- Output:
solution(centers) = 2
Explanation:
(1, 1)
and(2, 2)
:|x[1] - x[0]| = 1
,|y[1] - y[0]| = 1
(both ≤ 2) → intersect.
(2, 2)
and(0, 4)
:|x[2] - x[1]| = 2
,|y[2] - y[1]| = 2
(both ≤ 2) → intersect.
(1, 1)
and(0, 4)
:|x[2] - x[0]| = 1
(≤ 2), but|y[2] - y[0]| = 3
(> 2) → no intersection.
Input/Output:
- Input:
centers = [[1, 1], [2, 2], [0, 4], [1, 1]]
- Output:
solution(centers) = 4
Explanation:
- First three crystals intersect as in the previous example.
- The last crystal shares the same position as the first one:
- Intersects with the second one's field → +1 intersection.
- Intersects with the first one's field → +1 intersection.
我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。
We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.