some learning from problems.
INPUT OUTPUT A 1 AA 27 BA 53 AAA 703 // TIME : O(n) #include<stdio.h> #include<string.h> int main() { int i=0,l,x,index=0; char S[5]; printf("Enter Column header : "); gets(S); l=strlen(S); while(i<l) { x=S[i++]-'A'+1; index=index*26+x; } printf("%d",index); return 0; }
No comments:
Post a Comment