
You are given four independent coding questions.
You are given two arrays of equal length prices and ratings (each ratings[i] is an integer from 1 to 5).
Define the value-for-money score of item i as:
score(i) = ratings[i] / prices[i]
Return the index of the item with the maximum score. If multiple items tie for the maximum score, return the smallest index among them.
Assume prices[i] > 0. Use 0-based indices.
You are given:
departure_times
: an array of strings, each in 24-hour format
"HH:MM"
, representing bus departure times within the same day (e.g.,
["11:20", "15:00"]
).
current_time
: a string
"HH:MM"
representing the current time within the same day.
You must find the departure time that is the latest time strictly earlier than current_time (i.e., if a bus departs at exactly current_time, it is not considered “already departed”).
Return how many minutes have passed since that departure:
current_time - last_departure_time
in minutes
If there is no departure time strictly earlier than current_time, return -1.
You are given a 2D character matrix puzzle whose cells contain only:
'0'
–
'9'
, or
'+'
, or
'-'
You must choose a path that forms a valid arithmetic expression and return the maximum value achievable.
Rules:
+
and
-
(equivalently, left-to-right evaluation since precedence is the same).
Return the maximum evaluated result among all valid paths. (Assume at least one valid expression exists unless you decide to return something like negative infinity / null if none exists.)
You are given two integer arrays:
primary
secondary
You are also given a list of operations operations, each operation is one of:
[0, index, val]
meaning set
secondary[index] = val
.
[1, targetSum]
meaning count the number of pairs
(i, j)
such that:
0 <= i < len(primary)
,
0 <= j < len(secondary)
, and
primary[i] + secondary[j] == targetSum
For each Type 1 operation, output its count. Return all Type 1 results in order as an array.
Constraints are not specified; your solution should handle many operations efficiently (faster than recomputing all pairs on every query).