Question d’entretien chez 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.

Réponse à la question d'entretien

Utilisateur anonyme

13 avr. 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.