Roman to Integer

Given a Roman numeral, Write a code to convert roman to integer value.

Roman numerals are represented by seven different letters (I, V, X, L, C, D, M). These seven letters are used to make thousands of numbers.

Roman Numerals Symbol and It's decimal value.

For example –

Example 1 –

Input  : II , Output : 2

Example 2 –

Input  : XI , Output : 11

Example 3 – 

Input  : IV , Output : 4

Example 4 – 

Input : LVII , Output: 57 

NOTE : The given input is guaranteed to be within the range from 1 to 3999.

Group Anagrams Together

Given an array of strings or a list of words, write a code to group anagrams together.

what are Anagrams?

Two strings are said to be anagrams of each other if it contains the same characters, only the order of character in both the strings is different.

Check whether two strings are anagrams of each other or not

For example, Word “car” and “rac” are anagrams of each other. As both, the strings contain the same number of characters only the order of character is different in both the strings.

Now, let’s understand this problem statement with example.

For example:

Input: {“eat”, “tea”, “tan”, “ate”, “nat”, “bat”}

Output:

Find Longest Common Prefix in an Array of Strings

How to find longest common prefix in an array of strings.

Given an array of strings, write a method to find the longest common prefix string. If no common prefix is found, return an empty string ” “.

For example:

Example 1:

Input: [“cat”,”cable”,”camera”]
Output: “ca”

The longest common prefix is ca.

Example 2:

Input: [“rat”,”dog”,”elephant”]
Output: “”

No common prefix is found.