Selective Additions

  • + 0 comments

    this is my c# code inside for loop, but getting time out.someone help me

    for(long i =l-1;i<r;i++)
    {
        A[i] = (S.Contains(A[i])) ? A[i] : A[i] + x;
    }
    Console.WriteLine(A.Sum());