Leetcode 12. Integer to Roman in Python | Python Leetcode | Python Coding Tutorial | Interview

preview_player
Показать описание
Leetcode 12. Integer to Roman in Python | Python Leetcode | Python Coding Tutorial | Interview

Seven different symbols represent Roman numerals with the following values:
SymbolValueI1V5X10L50C100D500M1000
Roman numerals are formed by appending the conversions of decimal place values from highest to lowest.
Given an integer, convert it to a Roman numeral.

Example 1:

Input: num = 3749
Output: "MMMDCCXLIX"
Explanation:
3000 = MMM as 1000 (M) + 1000 (M) + 1000 (M)
700 = DCC as 500 (D) + 100 (C) + 100 (C)
40 = XL as 10 (X) less of 50 (L)
9 = IX as 1 (I) less of 10 (X)
Note: 49 is not 1 (I) less of 50 (L) because the conversion is based on decimal places

Example 2:

Input: num = 58
Output: "LVIII"
Explanation:
50 = L
8 = VIII

Example 3:

Input: num = 1994
Output: "MCMXCIV"
Explanation:
1000 = M
900 = CM
90 = XC
4 = IV

Please don’t forget to Like ,Comment and Share the Videos!
Each and every Like , Comment and Share helps us!

Thanks for Watching🙏😍😘

Please Subscribe to watch more videos.

In case of any copyrighted Content, Please reach out to us.

* Hope you like it

📷 Welcome to Code is Art! 👨‍💻

🔗 Follow us on social media:

Join our coding community and follow us on Instagram for coding inspiration 🎨, GitHub for code collaboration 🐙, Twitter for coding updates 🐤, Reddit for coding discussions 🤖, Facebook for coding news 📚, YouTube for coding tutorials 🎬, and Discord to connect with fellow coders and share your experiences 🎧. Let's grow our coding skills together! #CodeIsArt #FollowUsNow 👨‍💻💻🐤📱📚🎬🎧

Рекомендации по теме