The Array Height Checker Problem in Java
The challenge
Students are asked to stand in non-decreasing order of heights for an annual photo.
Return the minimum number of students that must move …
Read Article →342 articles about java development, tools, and best practices
Students are asked to stand in non-decreasing order of heights for an annual photo.
Return the minimum number of students that must move …
Read Article →Given an array of integers A
sorted in non-decreasing order, return an array of the squares of each number, also in sorted …
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 …
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 the array …
Read Article →Given an array arr
, replace every element in that array with the greatest element among the elements to its right, and replace the last …
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 …
Read Article →Given an array nums
of integers, return how many of them contain an even number of digits.
Example 1:
Example 2:
Constraints:
1 …
A HashSet
is an unordered collection containing unique elements. It has the standard collection operations Add, Remove, Contains, …
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 …
Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.
Example: …
Read Article →Given an integer array nums
, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. …
Given a positive integer num
, output its complement number. The complement strategy is to flip the bits of its binary representation. …