TCS Coding Problem 16

4 comments on “TCS Coding Problem 16”


  • Debanjan

    # a=[10,5,10]
    a=[10, 10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,]
    a.sort(reverse=True)
    print(a)
    for i in range(1,len(a)):
    if a[i]!=a[i-1]:
    print(a[i])
    break
    if i==len(a)-1:
    if a[len(a)-1]==a[len(a)-2]:
    print(“All Values are same”)


  • Sadique Gametor

    #include
    int main()
    {
    int n;
    scanf(“%d”,&n);
    int b[n],i,j,temp;
    for(i=0;i<n;i++)
    {
    scanf("%d",&b[i]);
    }
    for(i=0;i<n;i++)
    {
    for(j=i+1;j<n;j++)
    {
    if(b[i]<b[j])
    {

    temp=b[i];
    b[i]=b[j];
    b[j]=temp;
    }
    }
    }
    printf("%d",b[1]);
    return 0;
    }