Problem link: https://www.hackerrank.com/challenges/detect-html-tags
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:
Some tags can also have attributes. For example, here we see the “a” tag which is used for adding links to a document.
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.
[The problem appeared in TopCoder SRM 279 (Div-2, Level-1) and SRM 279 (Div-1, Level-1)]
Problem link: http://community.topcoder.com/stat?c=problem_statement&pm=5950&rd=8076
A sentence is called dancing if its first letter is uppercase and the case of each subsequent letter is the opposite of the previous letter. Spaces should be ignored when determining the case of a letter. For example, “A b Cd” is a dancing sentence because the first letter (‘A’) is uppercase, the next letter (‘b’) is lowercase, the next letter (‘C’) is uppercase, and the next letter (‘d’) is lowercase.
You will be given a String sentence. Turn the sentence into a dancing sentence by changing the cases of the letters where necessary. All spaces in the original sentence must be preserved.
[The problem appeared in TopCoder SRM 274 (Div-2, Level-2) and SRM 274 (Div-1, Level-1)]
Problem link: http://community.topcoder.com/stat?c=problem_statement&pm=5881&rd=8071
A palindrome is a string that is spelled the same forward and backward. We want to rearrange letters of the given string baseString so that it becomes a palindrome.
You will be given a String baseString. Return the palindrome that can be made from baseString. When more than one palindrome can be made, return the lexicographically earliest (i.e., the one that occurs first in alphabetical order). Return “” (the empty string) if no palindromes can be made from baseString.
[The problem appeared in TopCoder SRM 280 (Div-1, Level-1) and TopCoder SRM 280 (Div-2, Level-2)]
Problem link: http://community.topcoder.com/stat?c=problem_statement&pm=5977
A series of brackets is complete if we can pair off each left bracket ‘[‘ with a right bracket ‘]’ that occurs later in the series. Every bracket must participate in exactly one such pair.
Given a String text add the minimal number of brackets to the beginning and/or end of text to make it complete. Return the result.