Day 53👾:
Given an arrayarr[]
and a number target, find a pair of elements(a, b)
inarr[]
, wherea<=b
whose sum is closest to target.
Note: Return the pair in sorted order and if there are multiple such pairs return the pair with maximum absolute difference. If no such pair exists return an empty array.
🔥3⚡1👍1🕊1
Day 56👾:
Given an arrayarr[]
containing only non-negative integers, your task is to find a continuous subarray (a contiguous sequence of elements) whose sum equals a specified value target. You need to return the 1-based indices of the leftmost and rightmost elements of this subarray. You need to find the first subarray whose sum is equal to the target.
Note: If no such array is possible then,return [-1]
.
🔥3👍1🥰1👏1
Day 60👾:
Given an arrayarr[]
of non-negative integers, where each elementarr[i]
represents the height of the vertical lines, find the maximum amount of water that can be contained between any two lines, together with thex-axis
.
Note: In the case of a single vertical line it will not be able to hold water.
👍3🔥1🥰1👏1
Day 61👾:
Given an array of integersarr[]
, the task is to find the first equilibrium point in the array.
The equilibrium point in an array is an index (0-based indexing
) such that the sum of all elements before that index is the same as the sum of elements after it.Return -1
if no such point exists.
❤2👏2👍1🔥1