Skip to content

wolfy222/HackerRank-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HackerRank-Java

Question - 1 Welcome to Java!

 The code stubs in your editor declare a Solution class and a main method.
 Complete the main method by copying the two lines of code below and pasting them inside the body of your main method.

Question - 2 Java Stdin and Stdout II

In this challenge, you must read  integers from stdin and then print them to stdout.
Each integer must be printed on a new line. To make the problem a little easier,
a portion of the code is provided for you in the editor below

Question - 3 Java Stdin and Stdout II

 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 the code is provided for you in the editor.

Question - 4 Java If-Else

Given an integer, , perform the following conditional actions:
If  is odd, print Weird
If  is even and in the inclusive range of  to , print Not Weird
If  is even and in the inclusive range of  to , print Weird
If  is even and greater than , print Not Weird
Complete the stub code provided in your editor to print whether or not  is weird.

Question - 5 Java Loops I

 Given an integer, , print its first  multiples. Each multiple  (where )
 should be printed on a new line in the form: N x i = result

Question - 6 Java Loops II

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 integers.

Question - 7 Java End-of-file

The challenge here is to read  lines of input until you reach EOF, then number and print all  lines of content.

Question - 8 Java Static Initializer Block

You are given a class Solution with a main method. Complete the given code so that it outputs 
the area of a parallelogram with breadth  and height . You should read the variables from the standard input.
If  or  , the output should be "java.lang.Exception: Breadth and height must be positive" without quotes.

Question - 9 Java Int to String

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 will print "Wrong answer".

Question - 10 Java Strings Introduction

The elements of a String are called characters. The number of characters in a String is 
called the length, and it can be retrieved with the String.length() method.

Question - 11 Java Substring

 Given a string, s, and two indices,  eand , print a substring consisting of all characters
 in the inclusive range from  to . You'll find the String class' substring method helpful in completing this challenge.

Question - 12 Java String Reverse

 Given a string , print Yes if it is a palindrome, print No otherwise.

Question - 13 Java Currency Formatter

 Given a double-precision number, , denoting an amount of money, use the NumberFormat class'
 getCurrencyInstance method to convert  into the US, Indian, Chinese, and French currency formats.

Question - 14 Java Stack

 Given a string, determine if it is balanced or not.

Question - 15 Java 1D Array

Reads an integer from stdin and saves it to a variable, , denoting some number of integers.
Attempts to print each element of an array of integers named .

Question - 16 Java 1D Array (Part 2)

About

Hacker Rank Questions in Java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published