introart's blog

By introart, history, 23 months ago, In English

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?

  • Vote: I like it
  • -10
  • Vote: I do not like it

| Write comment?
»
23 months ago, # |
  Vote: I like it 0 Vote: I do not like it

lol i misread and ended up solving this version in the contest with dsu