#126

Поделиться
HTML-код
  • Опубликовано: 28 дек 2024

Комментарии • 10

  • @anonymous-gq5vu
    @anonymous-gq5vu Год назад +1

    subscribed to your channel, please upload daily, even if i solve it on my own i'll look after your code ( to understand efficiency)

  • @statusworld-hj5jj
    @statusworld-hj5jj Год назад +1

    How did you know all the ans i spend 3 and half hour but still it won't pass all the test cases.
    Plz make a video how to approch to the problems

  • @SCSArumugaperumal
    @SCSArumugaperumal Год назад

    please do live for weekly contest and jobathon

  • @kunalkamble2318
    @kunalkamble2318 Год назад

    Roman Number to Integer
    ans
    class Solution:
    def romanToDecimal(self, S):
    roman_values = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
    result = 0
    prev_value = 0
    for i in range(len(S) - 1, -1, -1):
    current_value = roman_values[S[i]]
    if current_value < prev_value:
    result -= current_value
    else:
    result += current_value
    prev_value = current_value
    return result

  • @raushankumar6993
    @raushankumar6993 Год назад

    Thanks bro

  • @gamersgame43
    @gamersgame43 Год назад

    superb explained

  • @thisIsCodeSquare
    @thisIsCodeSquare Год назад +1

    i also tried this problem by myself but i wasn't getting the right answer as i was doint (n%26 - 1) + 'A' thanks for the explanation