vran.freelancer
BAN USER- 0of 0 votes
AnswersTwo words are friends if they have a Levenshtein distance of 1 (For details see http://en.wikipedia.org/wiki/Levenshtein_distance). That is, you can add, remove, or substitute exactly one letter in word X to create word Y. A word’s social network consists of all of its friends, plus all of their friends, and all of their friends’ friends, and so on. Write a program to tell us how big the social network for the word 'hello' is, using this word list https://raw.github.com/codeeval/Levenshtein-Distance-Challenge/master/input_levenshtein_distance.txt
- vran.freelancer in India
Input
Your program should accept as its first argument a path to a filename.The input file contains the word list. This list is also available at https://raw.github.com/codeeval/Levenshtein-Distance-Challenge/master/input_levenshtein_distance.txt.
Output
Print out how big the social network for the word 'hello' is. e.g. The social network for the word 'abcde' is 4846.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a graph based on a set of nodes and links, write a program that shows all the possible paths from 2 distinct nodes. It is up to you to decide what kind of structure you want to use to represent the nodes and links.
- vran.freelancer in United States
Example:
Let's say there are 4 nodes, named as 'a', 'b', 'c', 'd'.
And there are 4 links that connect 'a & b', 'b & d', 'a & c', and 'c & d', so that it will form a graph like the following:
---- b ----
a d
---- c ----
If the source is 'a', and the destination is 'd', your program should return:
a - b - d
a - c - d| Report Duplicate | Flag | PURGE
CCN Applications Developer Algorithm - 0of 0 votes
AnswersFind numbers in an array that sum to a certain number....Once number is found return the index of both the numbers...We are not allowed to use Hashmap or any other DS...we have to do it inplace...using the same array
- vran.freelancer in United States for ERP solution| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Arrays
i gave the solution first Using the HashMap...with O(N)..after that Interviewer said he will make it harder..and ask me to avoid usage of HashMap...Also here We have to return the INDEX not the number...I think sorting doesn't help here...isn't it ?
- vran.freelancer October 25, 2011Here disregard int final_count=3; In addition to that instead of considering we have been given String Pattern = "aaabbddddbadfbbbassb";...We can assume that we are getting this string from the console or some file etc. I would like to have your views on this code friends. I am a naive programmer. will appreciate your feedback !! :=)
- vran.freelancer September 15, 2011<pre lang="" line="1" title="CodeMonkey97107" class="run-this">public static void main(String []args)
{
String Pattern = "aaabbddddbadfbbbassb";
String strMatch = "aaa";
int strLength = strMatch.length();
int final_count=3;
int count=0,j=0,i=0;
while(true)
{
if(strMatch.charAt(j++)==Pattern.charAt(i))
{
count+=1;
if(count==strLength)
{
System.out.println("String found at index " + (i-1));
return;
}
i++;
}
else
{
j=0;
i++;
count=0;
continue;
}
}
}
</pre><pre title="CodeMonkey97107" input="yes">
</pre>
RepKarlDuffie, AOL tech support at 8x8
As an Information Architect with a passion for optimizing digital experiences, I thrive on organizing and structuring information to enhance ...
RepNoelleBurgess, Ticket clerk at Handyman
As a Ticket Clerk with a penchant for the exhilarating world of cricket, my professional journey harmoniously blends the meticulousness ...
@eugene.yarovoi: Initially the Question was to provide pair of numbers which sum to the target number...Once i gave the solution with HashMap, he said now Retrieve the Index of those 2 numbers...i did that as well with O(N)...But now...he said lets remove the HashMap from the picture...And i was required to use only an array !!
- vran.freelancer October 25, 2011I understand your solution of Binary search to get 2 numbers and if array is sorted..but what about the index in that case ?? as my questions was to provide index and not the number !! please share your thoughts. Thanks !!