diff --git a/Infos b/Infos new file mode 100644 index 0000000..12e5510 --- /dev/null +++ b/Infos @@ -0,0 +1,61 @@ +Hi, I am solving a problem on leetcode: https://leetcode.com/problems/roman-to-integer/ +And my code is failing the test:.. The code is: `int romanToInt(char * s){ + int stringSize; + stringSize = strlen(s); + int ans, counter; + int pos_I=0, pos_V=0, pos_X=0, pos_L=0, pos_C=0, pos_D=0, pos_M=0; + ans = 0; + counter = 0; + for(counter=0; counter=1 ) + { + if ((s[counter-1] == 'I') && counter >= 1) + { + ans = ans - 1; + } } + } + else if (s[counter] == 'X') + { + pos_X = counter; + ans = ans + 10; + if (counter >=1 ) + { + if ((s[counter-1] == 'I') && (counter >=1)) + { + ans = ans - 1; + } } + } + else if (s[counter] == 'L') + { + pos_L = counter; + ans = ans + 50; + if (counter >= 1) + { + if ((s[counter-1] == 'X') && (counter >= 1)) + { + ans = ans - 10; + } } + } + else if (s[counter] == 'C') + { + pos_C = counter; + ans = ans + 100; + if (counter >= 1) + { + if ((s[counter-1] == 'X') && (counter>=1)) + { + ans = ans - 10; + }} + }` \ No newline at end of file