Is this a gcc's bug?


  • 0
    L

    These two codes lead to different result, I don't find the reason, could someone help me, please?

    CODE1

    v[i] = (v[i+1] + ( s[i] == '1' || (s[i] =='2' && i + 1 < n &&s[i+1]<='6')) ? v[i+2] : 0);
    

    CODE2

       if(s[i] == '1' || (s[i]=='2' && i+1 < n && s[i+1] <='6')){
            v[i] = v[i+1] + v[i+2];
       }
       else{
           v[i] = v[i+1];
      }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.