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…
Two strings, and , are called anagrams if they contain all the same characters in the same frequencies. For example, the anagrams of CAT are CAT, ACT, TAC, TCA, ATC, and CTA. Complete the function in the editor. If and…
"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…
The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the…
You are given an integer , you have to convert it into a string. Please complete the partially completed code in the editor. If your code successfully converts into a string the code will print "Good job". Otherwise it…
"In computing, End Of File (commonly abbreviated EOF) is a condition in a computer operating system where no more data can be read from a data source." — (Wikipedia: End-of-file) The challenge here is to read lines of…
Java has 8 primitive data types; char, boolean, byte, short, int, long, float, and double. For this exercise, we'll work with the primitives used to hold integer values (byte, short, int, and long): A byte is an 8-bit…
We use the integers , , and to create the following series: You are given queries in the form of , , and . For each query, print the series corresponding to the given , , and values as a single line of space-separated…
Objective In this challenge, we're going to use loops to help us do some simple math. Task Given an integer, , print its first multiples. Each multiple (where ) should be printed on a new line in the form: N x i =…
Java's System.out.printf function can be used to print formatted output. The purpose of this exercise is to test your understanding of formatting output using printf. To get you started, a portion of the solution is…
In this challenge, you must read an integer, a double, and a String from stdin, then print the values according to the instructions in the Output Format section below. To make the problem a little easier, a portion of…
In this challenge, we test your knowledge of using if-else conditional statements to automate decision-making processes. An if-else statement has the following logical flow: Source: Wikipedia Task Given an integer…
Most HackerRank challenges require you to read input from stdin (standard input) and write output to stdout (standard output). One popular way to read input from stdin is by using the Scanner class and specifying the…
This Java 8 challenge tests your knowledge of Lambda expressions! Write the following methods that return a lambda expression performing a specified action: PerformOperation isOdd(): The lambda expression must return if…
Java annotation can be used to define the metadata of a Java class or class element. We can use Java annotation at the compile time to instruct the compiler about the build process. Annotation is also used at runtime to…
You are given a class Solution and an inner class Inner.Private. The main method of class Solution takes an integer as input. The powerof2 in class Inner.Private checks whether a number is a power of . You have to call…
In computer science, a priority queue is an abstract data type which is like a regular queue, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority…
In computer science, a double-ended queue (dequeue, often abbreviated to deque, pronounced deck) is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front…
Comparators are used to compare two objects. In this challenge, you'll create a comparator and use it to sort an array. The Player class is provided for you in your editor. It has fields: a String and a integer. Given…
A string containing only parentheses is balanced if the following is true: 1. if it is an empty string 2. if A and B are correct, AB is correct, 3. if A is correct, (A) and {A} and [A] are also correct. Examples of some…