← Roman to Integer
Discussions
Sign in to join the discussion.
S
saiaga1
2 days, 2 hours ago
Intuition + complexity breakdown for Roman to Integer.
Use a hash map from value to index (or count). For each element check whether its complement is already in the map, then insert it. That makes it O(n) instead of the O(n²) brute force.
💬 1 reply
D
deepikakap7
1 week, 4 days ago
Asked in my Paytm OA last week.
Use a hash map from value to index (or count). For each element check whether its complement is already in the map, then insert it. That makes it O(n) instead of the O(n²) brute force.
💬 2 replies
D
dkaur
3 months, 2 weeks ago
Finally got AC after 3 WAs. Sharing what I missed.
Use a hash map from value to index (or count). For each element check whether its complement is already in the map, then insert it. That makes it O(n) instead of the O(n²) brute force.
💬 1 reply