Ebay Interview Question for Member Technical Staffs
- -1of 1 vote
Read a file and create a a datastructure which holds all the anagrams of words conatined in the file..- vasa.v03 January 28, 2013 in India
For e.g lets say file content is "abc bca"
we need a DS to say "abc" and "cba" are anagrams.
I told i will use a FileReader to read characters than bytes
and assing a prime number for each alphabet
a - 2
b - 3
c - 5
and calculate the compound ofr multiplication
say abc = 2 * 3 * 5 = 30
bca = 3 * 5 * 2 = 30
i will use the compound a key in hashmap.
like 30 = abc-> bca -> cba
Let me know for any other better solution
| Report Duplicate | Flag | PURGE
Ebay Member Technical Staff Data Structures
Interview Type: In-Person
Open Chat in New Window