Domanda di colloquio di NVIDIA

First Question: Python question: Find all unique elements listLang = [CPP, PYTHON, JAVA, JAVA, CPP] Second Question: Public int foo(List<Integer> nums){ Int x = -1; Int y = -1; For(Integer num : nums){ If(x < num){ Y = x; X = num; } Return y; { What is the code supposed to do? What is the problem? How can you fix it? (They said they weren't supposed to ask this question, they were curious.

Risposta di colloquio

Anonimo

13 apr 2022

First question: They wanted me to use "Set" Second question: Finds the second maximum. The problem is in the if part. I'm not sure how to solve.