Solving LeetCode #13 Roman to Integer in Python

Day 48/100 – #100DaysOfCode 🚀 Solved LeetCode #13 – Roman to Integer (Python). Today I practiced string processing and mapping logic to convert Roman numerals into integers. Approach: 1) Create a dictionary to map Roman symbols to their integer values. 2) Traverse the string from left to right. 3) If the current value is less than the next value, subtract it. 4) Otherwise, add it to the total. 5) Return the final result. Time Complexity: O(n) Space Complexity: O(1) Understanding pattern-based problems in strings 💪 #LeetCode #Python #DSA #Strings #ProblemSolving #100DaysOfCode

  • graphical user interface, text

To view or add a comment, sign in

Explore content categories