i am solving this question https://leetcode.com/problems/longest-consecutive-sequence/
my code is as follows,
class Solution {
public:
int longestConsecutive(vector& nums) {
if(nums.empty()) return 0;
int n=nums.size() ;
unordered_set<int> s;
int max_length = 0;
int max = MIN_INT ;
int min = MAX_INT ;
for(int i=0;i<n;i++){
if(nums[i]>max) max=nums[i];
if(nums[i] < min) min=nums[i];
for(int i=0;i<n;i++){
if(s.find(nums[i]) != s.end()){
int count1=0 , count2=0 , length =0;
for(int j=1;j<=(nums[i]-min);j++)
{
if(s.find(nums[i]-j) != s.end() ) count1++;
else break;
}
for(int j=1;j<=(max-nums[i]);j++)
{
if(s.find(nums[i]+j) != s.end() ) count2++;
else break;
}
length = count1 + count2 + 1;
if(length>max_length) max_length=length;
}
else s.insert(nums[i]);
}
}
return max_length ; };
but when i am trying to compile it gives following type of error,
Line 73: Char 28: error: expected '}'
#pragma GCC optimize ("O1")
^
Anyone here if you knows about it than please reply