Tag Archives: generics

Extract Leaves of a Binary Tree in a Doubly Linked List : GeeksforGeeks

Problem link: http://www.geeksforgeeks.org/connect-leaves-doubly-linked-list/

Problem Statement:
Given a Binary Tree, extract all leaves of it in a Doubly Linked List (DLL). Note that the DLL need to be created in-place. Assume that the node structure of DLL and Binary Tree is same, only the meaning of left and right pointers are different. In DLL, left means previous pointer and right means next pointer.
Continue reading

Advertisements

Boundary Traversal of Binary Tree : GeeksforGeeks

Problem link: http://www.geeksforgeeks.org/boundary-traversal-of-binary-tree/

Problem Statement:
Given a binary tree, print boundary nodes of the binary tree Anti-Clockwise starting from the root.
Continue reading

Detect HTML Tags: Hackerrank

Problem link: https://www.hackerrank.com/challenges/detect-html-tags

Problem Statement:
In this problem you will use regular expressions to help you detect the various Tags used in an HTML document.

Here are a few examples of tags:

The “p” tag for paragraphs:

<p>This is a paragraph</p>

It is also okay to have one or more spaces before or after the tag name:

<  p >This is also a paragraph</p>

Then, there is also something called a void or an empty tag such as:

<p></p>

Some tags can also have attributes. For example, here we see the “a” tag which is used for adding links to a document.

<a href="http://www.google.com">Google</a> 

There are also tags such as this which haven’t been split into an opening and closing tag:

In the above case, “a” is the tag and “href” is an attribute, the value of which is “http://www.google.com”. Ignore any attributes. Your task is to find out all the tags present in the given document.
Continue reading

Unfriendly Numbers: Hackerrank

Problem link: https://www.hackerrank.com/challenges/unfriendly-numbers

Problem Statement:
There is one friendly number and N unfriendly numbers. We want to find how many numbers are there which exactly divide the friendly number, but does not divide any of the unfriendly numbers.
Continue reading