What century is it in Java
The challenge
Return the century of the input year. The input will always be a 4 digit string, so there is no need for validation.
345 articles about java development, tools, and best practices
Return the century of the input year. The input will always be a 4 digit string, so there is no need for validation.
An ordered sequence of numbers from 1 to N is given. One number might have deleted from it, then the remaining numbers were mixed. Find …
Read Article →In this challenge, we are going to reverse a string while maintaining the spaces (if any) in their original place.
For example: …
Read Article →Take the following IPv4 address: 128.32.10.1
This address has 4 octets where each octet is a single byte (or 8 bits).
128 has …The drawing shows 6 squares the sides of which have a length of 1, 1, 2, 3, 5, 8. It’s easy to see that the sum of the perimeters …
Read Article →Number is a palindrome if it is equal to the number with digits in reversed order. For example, 5, 44, 171, 4884 are palindromes, and 43 …
You are given an array of strings and your task is to remove all consecutive duplicate letters from each string in the array.
For …
Read Article →Given a list of numbers, determine whether the sum of its elements is odd or even.
Give your answer as a string matching "odd" …
In this challenge, you have to create all permutations of an input string and remove duplicates if present. This means you have to …
Read Article →You will be given a certain array of length n, such that n > 4, having positive and negative integers but there will be no zeroes and …
Consider the numbers 6969 and 9116. When you rotate them 180 degrees (upside down), these numbers remain the same. To clarify, if we …
In this challenge your mission is to rotate matrix counter-clockwise N times.
So, you will have 2 inputs:
1) matrix
2) a number, how …
Read Article →
Write a function that accepts two square (NxN) matrices (two dimensional arrays), and returns the product of the two. Only square …
Complete the function that takes 3 numbers x, y and k (where x ≤ y), and returns the number of integers within the range [x..y] (both …
Write a method, that gets an array of integer-numbers and return an array of the averages of each …
Read Article →Coding decimal numbers with factorials is a way of writing out numbers in a base system that depends on factorials, rather than powers …
Read Article →Return the number (count) of vowels in the given string.
We will consider a, e, i, o, u as vowels for this challenge (but not y).
The …
Read Article →You are going to be given an array of integers. Your job is to take that array and find an index N where the sum of the integers to the …
Read Article →In the following 6 digit number:
283910
91 is the greatest sequence of 2 consecutive digits.
In the following 10 digit number: …
Read Article →Write a function that takes a positive integer and returns the next smaller positive integer containing the same digits.
For example: …
Read Article →Given an array of integers.
Return an array, where the first element is the count of positives numbers and the second element is sum of …
Read Article →You are given an odd-length array of integers, in which all of them are the same, except for one single number.
Complete the method …
Read Article →In a grid of 4 by 4 squares you want to place a skyscraper in each square with only some clues:
If you have received the package org.junit.jupiter.api deos not exist error when trying to run a JUnit Java Test with Maven, it’s …