Problem: Compare Even and Odd Index Sums
Given an array of integers numbers
, compare the sum of elements on even positions against the sum of elements on odd positions (0-based). Return "even"
if the sum of elements on even positions is greater, "odd"
if the sum of elements on odd positions is greater, or "equal"
if both sums are equal.
Notes
You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(numbers.length^2)
will fit within the execution time limit.
Example
# For numbers = [1, 2, 3, 4, 5], the output should be:
solution(numbers) = "even"
Problem: Maximum Fish Caught with Limited Baits
Imagine that you are going fishing at the local pond. The size of the bait must be strictly smaller than the size of the fish for it to catch. Once the fish is caught, it is removed from the pond and cannot be caught again. However, each bait can be used up to 3
times before depletion.
Given two arrays of fish
and baits
, where fish[i]
corresponds to the size of the i
th fish in the pond, and baits[j]
corresponds to the size of the j
th bait, your task is to return the maximum number of fish you can catch from the pond with the given baits.
Instructions
To compute the answer, you need to use each bait to its possible extent, going from the largest bait to the smallest bait. Use each bait to catch the largest fish remaining in the pond and move to the next bait if the current bait was used three times or if it is not strictly smaller than the largest remaining fish.
Problem: Simulate Box Rotation and Gravity
You are given a matrix of characters representing a big box. Each cell of the matrix contains one of three characters:
'.'
, which means that the cell is empty;'*'
, which means that the cell contains an obstacle;'#'
, which means that the cell contains a small box.
You decide to rotate the big box clockwise to see how the small boxes will fall under the gravity. After rotating, each small box falls down until it lands on an obstacle, another small box, or the bottom of the big box.
Given box
, a matrix representation of the big box, your task is to return the state of the box after rotating it clockwise.
Notes
You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(box.length * box[0].length^2)
will fit within the execution time limit.
Example
box = [['#', '#', '.', '.', '.', '.', '.', '.'],
['#', '#', '#', '.', '.', '.', '.', '.'],
['#', '#', '#', '.', '.', '.', '#', '.']]
solution(box) = [['.', '.', '.', '#'],
['.', '.', '.', '#'],
['.', '.', '.', '#'],
['#', '.', '.', '#'],
['#', '#', '.', '#'],
['#', '#', '#', '.'],
['#', '#', '#', '.'],
['#', '#', '#', '.']]
Problem: Reconstruct Circular Symbol Sequence
A group of intrepid adventurers is on a quest to decode a mysterious artifact that has a series of unique symbols etched along its circular edge. The order of these symbols has long been lost, but a collection of symbol pairs known to be adjacent to each other was found. Unfortunately, the pairs of symbols became jumbled over time, meaning each pair (x, y)
could be recorded either as (x, y)
or (y, x)
.
You are given an array symbolPairs
representing these shuffled pairs, and your task is to rediscover the original sequence of symbols on the artifact's circular edge.
Notes
Remember that any cyclic rotation of the sequence can be considered a correct solution, and the order of the sequence can be reversed as well because the circle has no fixed start or end. Please return any of the valid arrangements.
我们长期稳定承接各大科技公司如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.
