suresh
BAN USER- 2of 2 votes
AnswersProblem Statement
- suresh in India
You have two strings A and B. Each one contains some letters and exactly one asterisk.
You have to replace the asterisk in each string with a letter sequence (possibly of zero length) so that the resulting two
strings are equal. This equal string is what you have to return. Attempt to return the shortest possible string.
The letter sequences may be same or different.
If it is not possible to make the given strings equal, return the string "not-possible".
Additional Constraints
- A and B will contain only uppercase letters and asterisks.
- A and B will contain one asterisk each.
Examples
0)
"SOCIA*TWIST"
"SOCIALTWI*T"
Returns: "SOCIALTWIST"
1)
"HELLO*"
"HI*"
Returns: "not-possible"
2)
"PROFESS*"
"*PROFESS"
Returns: "PROFESS"
3)
"*EXAMPLETEST"
"THIRDEXAMPLE*"
Returns: "THIRDEXAMPLETEST"
4)
"*TELL"
"*AFRIEND"
Returns: "not-possible"
5)
"*"
"B*"
Returns: "B"
6)
"*C"
"D*"
Returns: "DC"
program should be written in java| Report Duplicate | Flag | PURGE
A9 Applications Developer Algorithm - 0of 0 votes
AnswersCan anyone provide implementation of Suffix tree and trie?
- suresh in India| Report Duplicate | Flag | PURGE
Data Structures - 0of 0 votes
AnswersWhat happens when you enter URL in browser.
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersWrite a program to convert a decimal number into binary your code should work on both big endian and small endian machine. U have given a variable which tell u whether machine is big endian or small endian
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven a graph, if we were to print all nodes within k hops of a given node, which algorithm would we use, the answer to this was obviously a Breadth first search. He followed it up asking, if one were to use Depth first search instead to code this problem instead, one would encounter bloated running times for Graphs with certain attributes (Perhaps Dense graphs or some such). Describe what types of graphs would a DFS algorithm falter with and why.
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersYou are given a sequence of black and white horses, and a set of k stables numbered 1 to k. You have to accommodate the horses into the stables in such a way that the following conditions are satisfied:
- suresh in India
a. You fill the horses into the stables preserving the order of horses. For instance, you cannot put for horse 1 into stable 2 and horse 2 into stable 1. You have to preserve the ordering of horses.
b. No stable should be empty and No horse should be left unaccommodated.
c. Take the product (number of white horses * number of black horses) for each stable and take the sum of all these products. This value should be the minimum among all possible accommodation arrangements.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven a continuous stream of strings, maintain strings such that duplicate are eliminated on the fly. The interviewer wanted working code. So coded the solution during the interview and emailed it to him 10 mins after.
- suresh in India
So if you get “Ted”, “John”, “Mark”, “Ted”, “David”, at the moment in
time, the list should contain John, Mark, David| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersYou have given M array each of size n all array are sorted separately write a program to make a big sorted array of size m*n . during discussion he told me to prove many lemma like height of tree is log(n)( for n elements) sum of n natural number is (n*n+1)/2 and many more. He modified problem many times don’t use extra space do it in space etc.
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersWrite a program to convert a decimal number into binary your code should work on both big endian and small endian machine. U have given a variable which tell u whether machine is big endian or small endian
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersU have given 10 files and you have given a string suggest data structure which ll facilitate efficient search of string in the file if string appears more than ones in that case u have to print line number and file in which they appear.
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersThere is a file which contains N words. There may be M anagrams in that file, K words on each anagrams. K>=1, M>=1, N>=1. You need to write an algorithm which will create one list for each anagram with k words and group all M lists with one data structure
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 0of 0 votes
AnswersGiven a read only linked list with next and random pointer , clone the list
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 1of 1 vote
AnswersIt was a design question. You have to design a game. it has different types of monsters and different weapons. hero would shoot monster. each monster would have some initial health. Each weapon would do some predefined damage to monster. when its health gets 0, monster would die/disappear. and there would be multiple levels. based on level, monster and their behavior would change.
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 0of 0 votes
AnswersGiven 2 rectangles , find whether they are overlapping or not.
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersData structure to push, pop and find min element in O(1) time.
- suresh in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures
RepPrestigeLuxuryRentals, Data Engineer at Car Rental
How to get the Exotic Car Rental Miami Beach for driving in vacation?Prestige Luxury Rentals always aim to give ...
RepEdwin Adcox, Dev Lead at Advisory Board Company
Welcome to the best and certified exotic car rental company of USA. Here, at Prestige luxury Rentals, we offer the ...
RepAmber Van is the top rated company that offers friendly and professional removals services.Our featured services includes domestic moves ...