Rage
BAN USERI haven't tested the your code but logic looks correct, there is one glitch that might cause problems in the interview.
The problem is with using a parser and its time complexity. You dont need to parse the whole html file when all you need are the attributes begining with href. A simple regex should suffice for it.
As simple python logic is as follows :
>>> line = "ABCDEF XYZ";
>>> LIMIT = 5
>>> newLines = ""
>>> while(len(line) > LIMIT) :
... index = line.rfind(' ', 0, LIMIT)
... if index == -1:
... index = line.find(' ', LIMIT)
... if index == -1:
... newLines = newLines + line
... line = ''
... else :
... newLines = newLines + line[0:index] + '/\n'
... line = line[index:]
...
>>> newLines = newLines + line
>>> print newLines
ABCDEF/
XYZ
in case you want to remove the whitespace while splitting you need to change the to the below line in the code :
line = line[index:] becomes line = line[index+1:]
Immutable objects are simply objects whose state (the object's data) cannot change after construction. Examples of immutable objects from the JDK include String and Integer.
And here is the answer to your question other question:
public class Mydate {
private final Date date;
public Mydate(Date date) {
this.date = new Date(date.getTime());
}
public getDate() {
return date;
}
}
Since the date object passed in the constructor was created elsewhere you cannot sheild it from being changed unless you create a copy of it and use that in this class
- Rage January 28, 2013one simple way to push all the possible anagram of these 5 words in a hash map and now simply read the queue and check if the string is present in the hash map. The problem can occur if the 5 words are of huge length thus requiring a lot of space.
Other more intrusive way could be create 5 hashmaps(one for each word) containing the characters and their count. Now every time you read a word from the queue create a similar hashmap and check if contents of hashmaps are same or not.
Repmelonydmaxwell, maintenence engineer at AMD
Hi, I am working as a health information technician and my work is to collect and maintain a patient's ...
here are we accounting for the fact that a and b has no limitation. Some here are taking a and b as int and also considering all of them as positive.
- Rage May 04, 2014