Building a String Pyramid 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 for these …
Read Article →In-depth guides, insights, and best practices for modern software engineering
You have to build a pyramid.
This pyramid should be built from characters from a given string.
You have to create the code for these …
Read Article →Write a simple function that takes polar coordinates (an angle in degrees and a radius) and returns the equivalent cartesian coordinates …
Read Article →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 …
Read Article →An abundant number or excessive number is a number for which the sum of its proper divisors is greater than the number itself.
The …
Read Article →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 …
Read Article →Convert an integer which is base 10, to a hexadecimal base 16 string.
Java provides various built-in options such as Integer.toString(a, …
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 to solve your …
Read Article →Your task is to programe:
String convertToString(int[] pol) {....} The method returns given by a parameter, (integer array) which …
Write function RemoveExclamationMarks which removes all exclamation marks from a given string.
Option 1:
class …
Read Article →
We need a function that can transform a number into a string.
What ways of achieving this do you know?
Simple, remove the spaces from the string, then return the resultant string.
class Solution {
static …
Read Article →
Suzuki is a monk who climbs a large staircase to the monastery as part of a ritual. Some days he climbs more stairs than others …
Read Article →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 →