Day 40👾:
Given a strictly sorted 2D matrixmat[][]
of sizen x m
anda
numberx
. Find whether the numberx
is present in the matrix or not.
Note: In a strictly sorted matrix, each row is sorted in strictly increasing order, and the first element of the ith row(i!=0)
is greater than the last element of the(i-1)th
row.
❤2👍2🔥1💯1
Day 45👾:
Given two integer arraysa[]
andb[]
, you have to find the intersection of the two arrays. Intersection of two arrays is said to be elements that are common in both arrays. The intersection should not have duplicate elements and the result should contain items in any order.
Note: The driver code will sort the resulting array in increasing order before printing.
🔥3❤1👍1👏1
Day 46👾:
Given two arraysa[]
andb[]
, the task is to find the number of elements in the union between these two arrays.
The Union of the two arrays can be defined as the set containing distinct elements from both arrays. If there are repetitions, then only one element occurrence should be there in the union.
Note: Elements ofa[]
andb[]
are not necessarily distinct.
🔥2👏2❤1👍1
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