Google | Phone | HTML DOM containsText
Anonymous User
3042

Position: SWE - ML

Given a DOM for a html doc. Implement the "containsText" function.

class Node {
    List<Node> getAllChildren();
	String getText();
	Node getParent();
	boolean isText();
}

Example:

Input: <span><b>this</b> is <i> it </i></span>

Sample Query:
containsText("his is"); // true
containsText("his it"); // false
containsText("this"); // true
containsText("this is"); // true

Unfortunately I was not able to understand the Ques. and all time got wasted in the clarification. I managed to write a working code in the last 5-10 mins of the Interview.
Verdict : Expecting Rejection

Comments (11)