Blog Posts

Solving “Duck Duck Goose” in Java

December 1, 2020

The challenge The objective of Duck, duck, goose is to walk in a circle, tapping on each player’s head until one is chosen.


Read More

Calculate averages from an int array in Java

November 30, 2020

The challenge Write function avg which calculates average of numbers in given list.


Read More

How to Rotate a String in Java

November 29, 2020

Rotating a String in Java is a common interview question, and albeit it quite a simple one, it tests many fundamental concepts.


Read More

Calculate the Sum without highest and lowest number in Java

November 28, 2020

The challenge Sum all the numbers of the array except the highest and the lowest element (the value, not the index!


Read More

How to Convert a String to an Array in Java

November 27, 2020

Java makes it easy to convert a string to an array by providing the built-in .


Read More

How to Loop and Combine Three Strings in Java

November 26, 2020

The challenge Create a function that will return a string that combines all of the letters of the three inputed strings in groups.


Read More

How to Localize The Barycenter of a Triangle in Java

November 25, 2020

The challenge The medians of a triangle are the segments that unit the vertices with the midpoint of their opposite sides.


Read More

How to Calculate a Valid Square in Java

November 24, 2020

The challenge Given the coordinates of four points in 2D space p1, p2, p3 and p4, return true if the four points construct a square.


Read More

How to Calculate Age Range Compatibility as an Equation in Java

November 23, 2020

The challenge Everybody knows the classic “half your age plus seven” dating rule that a lot of people follow (including myself).


Read More

How to Find the Longest Mountain in Array in Java

November 22, 2020

The challenge Let’s call any (contiguous) subarray B (of A) a mountain if the following properties hold:


Read More

How to tell what the CHMOD value of a file/directory is

November 21, 2020

chmod alters the permissions for a file or directory, you could allow full read/write access to a file or directory by running the following command:


Read More

How to Solve the “Decode a String” Challenge in Java

November 20, 2020

The challenge Given an encoded string, return its decoded string.


Read More

How to cleanup a /var/log/journal in Linux

November 19, 2020

You may find your /var/log/journal directory taking up a lot of disk-space.


Read More

How to Find the Maximum Difference Between Node and Ancestor in Java

November 18, 2020

The challenge Given the root of a binary tree, find the maximum value V for which there exist different nodes A and B where V = |A.


Read More

How to Find the Integral using Java

November 17, 2020

The challenge Create a function that finds the integral of the expression passed.


Read More

How to Build Strings from a Size in Java

November 16, 2020

The challenge Write a function stringy that takes a size and returns a string of alternating '1s' and '0s'.


Read More

Best Time to Buy and Sell Stock in Java

November 15, 2020

The challenge Say you have an array for which the ith element is the price of a given stock on day i.


Read More

How to Solve the “To square(root) or not to square(root)” Challenge in Java

November 14, 2020

The challenge Write a method, that will get an integer array as parameter and will process every number from this array.


Read More

Solving the Rule of Divisibility by 13 in Java

November 13, 2020

The challenge "A divisibility rule is a shorthand way of determining whether a given integer is divisible by a fixed divisor without performing the division, usually by examining its digits.


Read More

How to Calculate Buddy Strings in Java

November 12, 2020

The challenge Given two strings A and B of lowercase letters, return true if you can swap two letters in A so the result is equal to B, otherwise, return false.


Read More