[HackerRank Solutions] [Java] Introduction – Java Loops

Problem Statement In this problem you will test your knowledge of Java loops. Given three integers a, b, and n, output the following series: Input Format The first line will contain the number of testcases t. Each of the next t lines will have three integers, a, b, and n. Constraints: Output Format Print the […]

Read More

[HackerRank Solutions] [Algorithms] Warmup – Diagonal Difference

Problem Statement Given a square matrix of size N x N, calculate the absolute difference between the sums of its diagonals. Input Format The first line contains a single integer, N. The next N lines denote the matrix’s rows, with each line containing N space-separated integers describing the columns. Output Format Print the absolute difference between […]

Read More

[HackerRank Solutions] [Java] Introduction – Java Stdin and Stdout 2

Problem Statement Most of the problems on HackerRank require reading input from stdin (standard input) and writing output to stdout (standard output). One way to read from stdin is by using the Scanner class and specifying the InputStream as System.in. Alternatively, you can use the BufferedReader class. Lines of output can be written to stdout […]

Read More

[HackerRank Solutions] [Java] Introduction – Java If-Else

Problem Statement Using “if-else” you can perform decision making in Java. See the flowchart below (taken from wikipedia): This problem will test your knowledge on “if-else” statements. Given an integer N as input, check the following: If N is odd, print “Weird”. If N is even and, in between the range of 2 and 5(inclusive), […]

Read More

[HackerRank Solutions] [Java] Introduction – Java Stdin and Stdout 1

Problem Statement In most of the HackerRank challenges, you need to read input from stdin (standard input) and write your output in stdout (standard output). One way to take input from stdin is to use the Scanner class and read in from System.in. You can write your output to stdout by simply using the System.out.println(String) […]

Read More

[HackerRank Solutions] [Java] Introduction – Welcome to Java!

Problem Statement Welcome to the world of Java! Just print “Hello World.” and “Hello Java.” in two separate lines to complete this challenge. The code stub in the editor already creates the main function and solution class. All you have to do is copy and paste the following lines inside the main function.

Sample […]

Read More

[HackerRank Solutions] [Algorithms] Warmup – A Very Big Sum

Problem Statement You are given an array of integers of size N. You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large. Input The first line of the input consists of an integer N. The next line contains N space-separated integers […]

Read More

[HackerRank Solutions] [Algorithms] Warmup – Simple Array Sum

Problem Statement You are given an array of integers of size N. Can you find the sum of the elements in the array? Input The first line of input consists of an integer N. The next line contains N space-separated integers representing the array elements. Sample: 6 1 2 3 4 10 11 Output Output […]

Read More

[HackerRank Solutions] [Algorithms] Warmup – Solve Me First

HackerRank adalah situs yang dikhususkan untuk programmer atau siapapun yang ingin meningkatkan kemampuannya dalam memecahkan masalah yang diberikan. Melalui HackerRank, kita dapat mengukur kemampuan berlogika, pemahaman algoritma dan pemrograman kita dengan mengikuti challenge atau contest yang diadakan. Penulis sendiri baru beberapa hari gabung dan mengikuti beberapa challenge yang ada. Selanjutnya, penulis ingin berbagi solusi dari challenge yang […]

Read More

Mengenal Apache Maven

Terkadang, ketika kita membuat suatu project menggunakan sebuah IDE, misalnya Netbeans, ketika project tersebut ingin kita buka menggunakan IDE lain *dengan berbagai alasan*, misalnya Eclipse, kita tidak bisa langsung membuka projectnya. Kita harus membuat project baru di Eclipse, baru kemudian mengcopy data-data pada project sebelumnya. Hal ini tentu sangat merepotkan. Nah, Apache Maven hadir untuk […]

Read More