DSA · Big O & problem solving
Indexing is cheap; searching scans
Reading nums[i] takes constant time. includes has to compare values until it finds a match or reaches the end, so it is O(n) in the worst case.
If a loop calls includes for every input value, the combined work can become O(n²). A Set may be a better fit when the task is repeated membership checks.