Leetcode 2295: Problem Discussion

Revision en1, by introart, 2022-06-05 09:21:43

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 was 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?

Tags leetcode, array, hashmap, need help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English introart 2022-06-05 09:23:57 3 Tiny change: ' in nums` was not nece' -> ' in nums` is not nece'
en1 English introart 2022-06-05 09:21:43 494 Initial revision (published)