This problem came in today's Leetcode Weekly contest 296
.
The solution to this problem is pretty straightforward.
But my question is:
how can I solve the problem if the condition: operations[i][1] does not exist in nums
is not necessarily true.
As an example
Input: nums = [1,2,3,4], operations = [[2,3],[3,1],[1,4]]
Output: [4,4,4,4]
Can anyone please help me?
lol i misread and ended up solving this version in the contest with dsu
can you please share your approach?