Determine if N is divisible by X and Y 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.
Examples
1) n …
Read Article →
345 articles about java development, tools, and best practices
Create a function that checks if a number n is divisible by two numbers x AND y. All inputs are positive, non-zero digits.
1) n …
Read Article →
Given an array of integers as strings and numbers, return the sum of the array values as if all were numbers.
Return your answer as a …
Read Article →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 angles to each other.
The …
Read Article →Your task is to find the first element of an array that is not consecutive.
By not consecutive we mean not exactly 1 larger than the …
Read Article →Define String.prototype.toAlternatingCase (or a similar function/method such as …
Given an array of 3 integers a, b and c, determine if they form a pythagorean triple.
A pythagorean triple is formed when:
Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a …
Read Article →The objective of Duck, duck, goose is to walk in a circle, tapping on each player’s head until one is chosen.
Task: Given an array …
Read Article →Write function avg which calculates average of numbers in given list.
Option 1 (working through the problem): …
Read Article →Rotating a String in Java is a common interview question, and albeit it quite a simple one, it tests many fundamental concepts. Did I mention that it …
Sum all the numbers of the array except the highest and the lowest element (the value, not the index!).
(The highest/lowest element is …
Java makes it easy to convert a string to an array by providing the built-in .split() method on the String object.
Write a function to …
Read Article →Create a function that will return a string that combines all of the letters of the three inputed strings in groups. Taking the first …
Read Article →
The medians of a triangle are the segments that unit the vertices with the midpoint of their opposite sides. The three medians of a …
Read Article →Given the coordinates of four points in 2D space p1, p2, p3 and p4, return true if the four points construct a square.
The coordinate of …
Read Article →Everybody knows the classic “half your age plus seven” dating rule that a lot of people follow (including myself). …
Read Article →Let’s call any (contiguous) subarray B (of A) a mountain if the following properties hold:
B.length >= 30 …Given an encoded string, return its decoded string.
The encoding rule is: k[encoded_string], where the encoded_string inside the square …
Given the root of a binary tree, find the maximum value V for which there exist different nodes A and B where V = |A.val - B.val| and A …
Create a function that finds the integral of the expression passed.
In order to find the integral all you need to do is add one to the …
Read Article →Write a function stringy that takes a size and returns a string of alternating '1s' and '0s'.
The string should start with a 1.
A string …
Read Article →Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most …
Read Article →Write a method, that will get an integer array as parameter and will process every number from this array.
Return a new array with …
Read Article →"A divisibility rule is a shorthand way of determining whether a given integer is divisible by a fixed divisor without …