Hi,
In Q1. consider while iterating some cards have same or less marks than at that time of the value of maxMarks then maxMarks will not be updated. But Q2. all N cards have not the same marks. Therefore maxMarks will be updated N times.
So the n<=N will the correct relation.
If you still have doubt please write us again.
Regards,
Deepak
IITM Online Degree Team