Third Maximum Number with Java
The challenge
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The …
Read Article →In-depth guides, insights, and best practices for modern software engineering
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The …
Read Article →Perhaps you have a screen-share session coming up and you want a nice clean desktop to show everyone. Also, nobody will …
Given a string, find the first non-repeating character in it and return its index. If it doesn’t exist, return -1.
Examples: …
Read Article →What do you do when you create a new Maven Java project, and when you run it, you get the following error:
Error:java: error: release version 5 not …
I noticed an interesting thing with a certain visitor after posting a blog post to Facebook.
The IP address that the Facebook crawler uses to visit …
Read Article →Given a 32-bit signed integer, reverse digits of an integer.
Example 1:
Example 2:
Example 3:
Note:
Assume we are dealing with an …
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for …
Read Article →Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least …
Read Article →Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
Find all the …
Read Article →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 …