Lunatic Server Solutions Interview Report
- 0of 0 votes
Answerson last interview lunatic server solution asked 3 questions. one of them was very easy. the problem states that...
- PriyaDarad June 06, 2012 in United States
Given a stream of text, your task is to create a formatted paragraph out of it. The paragraph should be left justified and each line of text in the formatted paragraph should not exceed a given length. Each line should contain maximum possible characters.
In addition to the input text, a set of words with their possible hyphen positions will also be given. The hyphenation makes it possible sometimes to add incomplete words at the end of line, if the completed words overflow the line length limit. To indicate that this particular word is incomplete, a hyphen (-) is added at the end of such broken words. Remaining part of this word is placed at the beginning of the next line. The specified line length limit must be observed including the trailing hyphen character if any.
The input text will contain alphabets, digits, punctuation marks and spaces. The only white space character used is a blank space, which is used to separate words. Each line in a formatted paragraph begins with a non-blank character. Even if the input text has words separated by many spaces, your output should separate them by only single space or a line break.
Notes:
The list of hyphenated words will not include any punctuation marks that may occur in the text to be formatted. You may assume that the punctuation marks will occur only at the end of each word (alpha-numeric characters). That is there will not be words like They'll or Sita's anywhere in the input.
The word length will never exceed the line length limit.
The input text can always be formatted using the given constraints.
No word, hyphenated or otherwise will exceed a length of 20 characters.
Input specification:
First line has an integer n denoting the number of hyphenated words.
Next n lines give each of the hyphenated word with possible hyphen break positions in the word by a hyphen itself. For example, "hyphenate" is given as "hy-phen-ate" and "formatting" is given as "for-mat-ting".
Next line will be an integer denoting the maximum number of characters per line in the formatted paragraph, i.e., the line length limit.
Last line contains the text to be formatted into a paragraph. The entire text will be terminated by a new line. The length of text will not exceed 256 characters.
Output specification:
The output should be a sequence of characters, which begin each line of the formatted paragraph followed by a single new line character. Thus, there will be those many non-white space characters as there are lines in the formatted paragraph.
Sample Input and Output:
Input:
4
con-cept
pro-gram-ming
ob-vi-ous
im-pos-si-ble
25
Most people find the concept of programming obvious, but the doing impossible.
Output:
Mcos
Note : Candidate can not get characters of indices, which are multiple of 24.
you have to make program in java with proper coding and follow the problem statement.| Report Duplicate | Flag | PURGE
Lunatic Server Solutions Developer Program Engineer Java - 0of 0 votes
AnswersLunatic server solution got a project in which they have to make a intranet web campus.
- PriyaDarad June 06, 2012 in United States
so entry for software developer , company make this problem.
solution must be in java.
Consider a university having a very big campus spread in acres of land. The university is undergoing
computerization. All the departments (at-most 50) are to be connected to form the intranet of the university.
You have to write a program, implementing Prims algorithm, which will suggest the network topology and
also minimise the total length of cable for connecting all the departments. Input to the program will be
names of all the departments and straight line distances between the departments (Only those pairs of
departments between which cable can be laid will be given). Output of the program should be the minimum
length of the cable required.
Input specifications
The first line will contain 2 natural numbers, N and M, separated by a blank space. N indicated the number
of departments in the university and M indicates the number of pairs of departments where the cables can be
laid. The following M lines will specify the distances between M pairs of departments as
dept1 dept2 distance
Where dept1 and dept2 are names of the departments (maximum 20 characters) and distance is a positive
integer (>0). Assume that the given distances between each pairs of departments will be unique and these M
lines will contain atleast one pair for each department.
Output specifications
The first line of the output will be names of the departments as they are included in the solution separated by
blank space. If two or more departments are included at a time then their names should be printed in the
alphabetic order. The next line will be the minimum length of cable required to form the intranet, terminated
with a new line character.
Sample Input/Output
input
7 10
physics chemistry 8
biology physics 9
biology office 15
chemistry office 4
chemistry sanskrit 5
sanskrit office 7
english office 16
english sanskrit 19
english cs 12
sanskrit cs 6
output
chemistry office sanskrit cs physics biology english
44
Hint : a simple prim's algorithm is implemented.| Report Duplicate | Flag | PURGE
Lunatic Server Solutions Developer Program Engineer - 0of 0 votes
Answerslunatic server solution is monitoring the wrong file entry in the server.
- PriyaDarad June 06, 2012 in United States
so company made another a problem for it to monitor AVL tree violation.
The problem should be solved in java...
problem states that...
This problem requires you to monitor a tree for violation of the AVL balance criteria as the tree is being
constructed.
The input to the program consists of a sequence of numbers. As you read in each number, check where the
node is going to be inserted into the current tree. [At the start, the tree is empty.] If that insertion can cause
the balance of any of the nodes in the tree to go beyond what is allowed by the AVL criteria, DO NOT add
the number into the tree. Instead, print out the number into the standard output. Numbers which retain the
AVL property of the tree should be added to the tree at the appropriate place as per the method discussed in
class. Continue with the remaining numbers. Please note that you do not have to do any balancing of the
tree! The input is terminated by –1.
The output from the program consists of the numbers rejected by the program. At the end, you should also
print out the count of such numbers rejected.
Hint: It would help to keep the height of the left and right subtrees of each node along with the node. Also
note that the process of checking for violation and actually inserting are quite similar; in the former case you
do not update anything but do everything else. This observation can be used to write the code.
Sample Input/Output
Input
3 5 1 6 2 4 9 7 -1
Output
7 1
(This means rejected key(s) are: key 7, totally 1 rejected key)| Report Duplicate | Flag | PURGE
Lunatic Server Solutions Developer Program Engineer Trees and Graphs