## Sorting a Java Array by Parity

The challenge Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. You… Read More »Sorting a Java Array by Parity

The challenge Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. You… Read More »Sorting a Java Array by Parity

Say you have an array of primitive integers and you want to remove all duplicates. You can find out how many non-duplicate integers are in… Read More »Remove Duplicates from Sorted Array in Java

The challenge Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1.… Read More »Replace Elements with Greatest Element on Right Side using Java

Introducing the problem Given an array A of integers, return true if and only if it is a valid mountain array. Recall that A is a mountain array if and… Read More »The Valid Mountain Array Problem using Java

The challenge Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12… Read More »Find Numbers with Even Number of Digits using Java

What is a HashSet A HashSet is an unordered collection containing unique elements. It has the standard collection operations Add, Remove, Contains, but since it… Read More »How to use a Java HashSet by example

The Challenge An encoded string S is given. To find and write the decoded string to a tape, the encoded string is read one character at a time and the following… Read More »The Decoded String at Index using Java

The question Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Input: 1 \ 3 /… Read More »Find the Minimum Absolute Difference in BST using Java

The problem Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input:… Read More »Find Maximum Subarrays using Java

The problem Given a positive integer num, output its complement number. The complement strategy is to flip the bits of its binary representation. Example 1: Input: num =… Read More »Finding Number Complements using Java

Perhaps the first thing that most people ask when they hear the names of these two programming languages are. “Why do they have the same… Read More »Comparing Java and Javascript

In Java there are eight basic data types; which are: byte, short, int, long, float, double, boolean and char. It could realistically be said that… Read More »The Primary Data Types in Java

TLDR; Java has a few different ways of comparing variables and objects with one another. ==, equals(), compareTo() and compare(). Java provides various operators such… Read More »Comparing Objects in Java

As with many programming languages such as C, C++ and C# (known commonly as the C family), it is possible to “overload methods” (sometimes called… Read More »Overloading Operators in Java

Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to… Read More »How to get the Range Sum of Binary Search Tree using Java

Mocha is a Java Decompiler and is 100% FREE to use. The readme.txt file in the Mocha distribution offers the free usage license: The distribution… Read More »Mocha Java Decompiler Download

- « Previous
- 1
- …
- 3
- 4
- 5