sgarg
BAN USER- 6of 6 votes
AnswersIn a certain language which has same alphabets as in english language (ie. a-z), but the order of the alphabets is different (for eg 's' is the first character, 'g' is second, and likewise). Given a dictionary of this new language (which has words arranged according to new alphabetical order), FInd out the order of alphabets in this language.
- sgarg in India| Report Duplicate | Flag | PURGE
Amazon Google SDE1 Software Engineer / Developer SDE-2 Algorithm
find the difference b/w the horizontal co-ordinates (say h) n also for vertical coords (say v).
if (v==h) //a diagonal path to the target
moves=1;
path= diagonal
else //bishop will cover min(h.v) diagonally and the remaining in a straight line.
moves=2;
path=diagonal+ straight line to the target
we can use a hash map here of max size (n/2)........start traversing the array from 0 to (n/2)-1 element and put it into the map. If during this you encounter any element which is already in the map and has appeared once once .. stop .. dats ur answer ..
else from (n/2) index "i" remove the last range element (i - n/2 ) from the hash and insert "i"th element... continue the process untill u find ur answer
we can use the "no captcha" technique.. in which humans cant see any captcha with naked eyes (invisible), so proceed with the normal procedure, while the computer detect a captcha n thus getting caught/identified as non human
- sgarg June 15, 2013