The String Combat Challenge in Java
The challenge After a long conflict, the rulers of Nek and Glo have decided that a final duel should decide the fate of their countries.… Read More »The String Combat Challenge in Java
The challenge After a long conflict, the rulers of Nek and Glo have decided that a final duel should decide the fate of their countries.… Read More »The String Combat Challenge in Java
The challenge Pig Latin is an English language game where the goal is to hide the meaning of a word from people not aware of… Read More »Solving Single Word Pig Latin in Java
The challenge Little Annie is very excited for upcoming events. She want’s to know how many days she have to wait for a specific event.… Read More »Count the Days in Java
If you are using a HashMap to keep a running total of a series of elements, then you often need to increment a HashMap item,… Read More »Java HashMap Create or Increment Value
The challenge A strongness of an even number is the number of times we can successively divide by 2 until we reach an odd number… Read More »Get the Strongest even number in an interval in Java
The challenge How many times have we been asked this simple question in our daily lives by family, friends and strangers alike? In this challenge… Read More »What time is it? in Java
The challenge You have to build a pyramid. This pyramid should be built from characters from a given string. You have to create the code… Read More »Building a String Pyramid in Java
The challenge Write a simple function that takes polar coordinates (an angle in degrees and a radius) and returns the equivalent cartesian coordinates (rounded to… Read More »Cartesian coordinates from degree angle in Java
The challenge Given an array of integers, arr, find out 2 indices m, n(0<=m<=arr.length-1, 0<=n<=arr.length-1, m<=n), so that as long as all elements in the… Read More »Sort array by sorting its smallest sub-array in Java
The challenge An abundant number or excessive number is a number for which the sum of its proper divisors is greater than the number itself.… Read More »Excessively Abundant Numbers in Java
The challenge Write a function that takes two strings, A and B, and returns the length of the longest possible substring that can be formed from the concatenation… Read More »Unique Substring From Joined Strings in Java
The challenge Convert an integer which is base 10, to a hexadecimal base 16 string. Java provides various built-in options such as Integer.toString(a, 16), or… Read More »Converting from Base 10 to 16 (Decimal to Hex) in Java
If you have a single-digit number, and you need to format it to always have at-least two digits, then you can use the below function… Read More »How to Format Numbers by Prepending 0 to single-digit numbers in Javascript
The challenge Your task is to programe: String convertToString(int[] pol) {….} The method returns given by a parameter, (integer array) which represents a polynomial, the representation… Read More »String polynomial converter in Java
The challenge Write function RemoveExclamationMarks which removes all exclamation marks from a given string. The solution in Java code Option 1: Option 2: Test cases… Read More »How to Remove all Exclamation Marks from a String in Java
The challenge We need a function that can transform a number into a string. What ways of achieving this do you know? Examples: The solution… Read More »How to Convert a Number to a String in Java
The challenge Simple, remove the spaces from the string, then return the resultant string. The solution in Java code An alternative: Test cases to validate… Read More »How to Remove Spaces in a String in Java
The challenge Suzuki is a monk who climbs a large staircase to the monastery as part of a ritual. Some days he climbs more stairs… Read More »How many stairs will Suzuki climb in 20 years? in Java
The challenge Create a function that checks if a number n is divisible by two numbers x AND y. All inputs are positive, non-zero digits. The solution in Java code… Read More »Determine if N is divisible by X and Y in Java
The challenge Given an array of integers as strings and numbers, return the sum of the array values as if all were numbers. Return your… Read More »How to Sum a Mixed Array in Java
A Cuboid is a geometric object that is more or less cubic in shape. It is a solid which has six rectangular faces at right… Read More »Calculate the Volume of a Cuboid in Java
The challenge Your task is to find the first element of an array that is not consecutive. By not consecutive we mean not exactly 1… Read More »Find the first non-consecutive number in Java
The challenge altERnaTIng cAsE <=> ALTerNAtiNG CaSe Define String.prototype.toAlternatingCase (or a similar function/method such as to_alternating_case/toAlternatingCase/ToAlternatingCase in your selected language; see the initial solution for details) such that each lowercase letter… Read More »Alternating String Casing in Java
The challenge Given an array of 3 integers a, b and c, determine if they form a pythagorean triple. A pythagorean triple is formed when: c2 =… Read More »Solving the Pythagorean Triple in Java
The challenge Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a computer. When… Read More »How to Correct the Mistakes of the Character Recognition Software in Java