Optimize gas usage when checking max length of arrays
There are a few cases where some arrays have to be limited to a number of items.\\nAnd the max size is enforced by removing the last item if the array reached max size + 1.\\n```\\nif (leaderboard.length == MAX\\_LEADERBOARD\\_SIZE.add(1)) {\\n    leaderboard.pop();\\n}\\n```\\n\\n```\\nif (topUsers.length == MAX\\_TOP\\_USERS\\_SIZE.add(1)) {\\n    topUsers.pop();\\n}\\n```\\n\\n```\\nif (\\_addresses.length == MAX\\_GROUP\\_LEADERS\\_SIZE.add(1)) {\\n    groupsLeaders[\\_referralLink].pop();\\n}\\n```\\n\\nA simpler and cheaper way to check if an item should be removed is to change the condition to\\n```\\nif (limitedSizedArray.length > MAX\\_DEFINED\\_SIZE\\_FOR\\_ARRAY) {\\n    limitedSizedArray.pop();\\n}\\n```\\n\\nThis check does not need or do a SafeMath call (which is more expensive), and because of the limited number of items, as well as a practical impossibility to add enough items to overflow the limit, makes it a preferred way to check the maximum limit.
Rewrite the checks and remove SafeMath operations, as well as the addition by 1 and change the check to a “greater than” verification.
```\\nif (leaderboard.length == MAX\\_LEADERBOARD\\_SIZE.add(1)) {\\n    leaderboard.pop();\\n}\\n```\\n