You've successfully subscribed to The Poor Coder | Hackerrank Solutions
Great! Next, complete checkout for full access to The Poor Coder | Hackerrank Solutions
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.

Strings

Beeze Aal

Hackerrank Strings Solution

C++ provides a nice alternative data type to manipulate strings, and the data type is conveniently called string. Some of its widely used features are the following: Declaration: string a = "abc"; Size: int len = a.size(); Concatenate two strings: string a = "abc"; string b = "def"; string c = a + b; // c
Beeze Aal

Hackerrank StringStream Solution

stringstream is a stream class to operate on strings. It basically implements input/output operations on memory (string) based streams. stringstream can be helpful in different type of parsing. The following operators/functions are commonly used here Operator >> Extracts formatted data.Operator << Inserts formatted data.Method
Beeze Aal

Hackerrank Valid Username Regular Expression Solution

.MathJax_SVG_LineBox {display: table!important} .MathJax_SVG_LineBox span {display: table-cell!important; width: 10000em!important; min-width: 0; max-width: none; padding: 0; border: 0; margin: 0} You are updating the username policy on your company's internal networking platform. According to the policy, a username is considered valid if all the
Beeze Aal

Hackerrank Pattern Syntax Checker Solution

Using Regex, we can easily match or search for patterns in a text. Before searching for a pattern, we have to specify one using some well-defined syntax. In this problem, you are given a pattern. You have to check whether the syntax of the given pattern is valid. Note: In
Beeze Aal

Hackerrank Java String Tokens Solution

Given a string, , matching the regular expression [A-Za-z !,?._'@]+, split the string into tokens. We define a token to be one or more consecutive English alphabetic letters. Then, print the number of tokens, followed by each token on a new line. Note: You may find the String.split method helpful
Beeze Aal

Hackerrank Java Anagrams Solution

.MathJax_SVG_LineBox {display: table!important} .MathJax_SVG_LineBox span {display: table-cell!important; width: 10000em!important; min-width: 0; max-width: none; padding: 0; border: 0; margin: 0} Two strings,  and , are called anagrams if they contain all the same characters in the same frequencies. For example, the anagrams of CAT are
Beeze Aal

Hackerrank Java Strings Introduction Solution

"A string is traditionally a sequence of characters, either as a literal constant or as some kind of variable." — Wikipedia: String (computer science)This exercise is to test your understanding of Java Strings. A sample String declaration: String myString = "Hello World!" The elements of a String are called characters. The
Beeze Aal

Hackerrank Tag Content Extractor Solution

In a tag-based language like XML or HTML, contents are enclosed between a start tag and an end tag like <tag>contents</tag>. Note that the corresponding end tag starts with a /. Given a string of text in a tag-based language, parse this text and retrieve
Beeze Aal

Hackerrank Java Regex 2 - Duplicate Words Solution

In this challenge, we use regular expressions (RegEx) to remove instances of words that are repeated more than once, but retain the first occurrence of any case-insensitive repeated word. For example, the words love and to are repeated in the sentence I love Love to To tO code. Can you
Beeze Aal

Hackerrank Java String Reverse Solution

A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward.(Wikipedia) Given a string , print Yes if it is a palindrome, print No otherwise. Constraints will consist at most  lower case english letters.Sample Input madam Sample Output Yes Solution in
Beeze Aal

Hackerrank Java Substring Comparisons Solution

Solution in java8Approach 1. public static String getSmallestAndLargest(String s, int k) { String smallest = s.substring(0, k); String largest = s.substring(0, k); for(int i = 0; i <= s.length() - k; i++){ String sTemp = s.substring(i, i + k); if(sTemp.compareTo(smallest) < 0) { smallest = sTemp;
Beeze Aal

Hackerrank Tag Content Extractor Solution

Solution in java8Approach 1. import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution{ public static void main(String[] args){ Pattern pattern = Pattern.compile("<([^>]+)>([^<]+)</\\1>"); Scanner in = new Scanner(System.in); int testCases = Integer.parseInt(