educative.io

Confusing explanation

In the solution of the problem on java language, there is confusing collection initialization.

line 4:
List < Integer > parms;

the solution without the list works good.

1 Like

Hi @Temur,

The problem “missing number” can be solved through various approaches. Using the List<Integers> approach is just one of those solutions to solve this problem. For example, we can also solve this problem by sorting the array nums to find the missing number.

In the end, the approach to solution is entirely of your choice, but remember to use the correct pattern and keep in check the time and space complexity of the code.

Feel free to share any more suggestions and feedbacks, we’d be happy to help, thanks!

Happy learning!