-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution.json
More file actions
52 lines (52 loc) · 2.83 KB
/
Copy pathsolution.json
File metadata and controls
52 lines (52 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
"data": {
"topic": {
"id": 2724200,
"viewCount": 40887,
"topLevelCommentCount": 37,
"subscribed": false,
"title": "\u2714\ufe0f Python's Simple and Easy to Understand Solution | 99% Faster \ud83d\udd25",
"pinned": false,
"solutionTags": [
{
"name": "Python",
"slug": "python"
},
{
"name": "Python3",
"slug": "python3"
}
],
"hideFromTrending": false,
"commentCount": 59,
"isFavorite": false,
"post": {
"id": 4379521,
"voteCount": 298,
"voteStatus": 0,
"content": "**\\uD83D\\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \\uD83D\\uDC4D**\\n\\nVisit this blog to learn Python tips and techniques and to find a Leetcode solution with an explanation: https://www.python-techs.com/\\n\\n**Solution:**\\n```\\nclass Solution:\\n def intToRoman(self, num: int) -> str:\\n # Creating Dictionary for Lookup\\n num_map = {\\n 1: \"I\",\\n 5: \"V\", 4: \"IV\",\\n 10: \"X\", 9: \"IX\",\\n 50: \"L\", 40: \"XL\",\\n 100: \"C\", 90: \"XC\",\\n 500: \"D\", 400: \"CD\",\\n 1000: \"M\", 900: \"CM\",\\n }\\n \\n # Result Variable\\n r = \\'\\'\\n \\n \\n for n in [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]:\\n # If n in list then add the roman value to result variable\\n while n <= num:\\n r += num_map[n]\\n num-=n\\n return r\\n```\\n**Thank you for reading! \\uD83D\\uDE04 Comment if you have any questions or feedback.**",
"updationDate": 1675229798,
"creationDate": 1666239191,
"status": "Open",
"isHidden": null,
"author": {
"isDiscussAdmin": false,
"isDiscussStaff": false,
"username": "pniraj657",
"nameColor": null,
"activeBadge": {
"displayName": "Data Structure I",
"icon": "https://assets.leetcode.com/static_assets/others/DS_I.png"
},
"profile": {
"userAvatar": "https://assets.leetcode.com/users/avatars/avatar_1644473093.png",
"reputation": 1430
},
"isActive": true
},
"authorIsModerator": false,
"isOwnPost": false
}
}
}
}