Find longest sequence of zeros in binary representation of an integer.
Find unpaired element in the odd integer array where all elements have pairs but one.
Means [1,1,2,2,3]
1 and 2 have a pair, 3 doesn't.
Rotate array elements clockwise.
Example: rotate([1,2,3,4,5],3) == [3,4,5,1,2]
You would like to set a password for a bank account. However, there are three restrictions on the format of the password:
it has to contain only alphanumerical characters (a−z, A−Z, 0−9);
there should be an even number of letters;
there should be an odd number of digits.
You are given a string S consisting of N characters. String S can be divided into words by splitting it at, and removing,
the spaces. The goal is to choose the longest word that is a valid password.
For example, given "test 5 a0A pass007 ?xy1", there are five words and three of them are valid passwords: "5", "a0A" and
"pass007". Thus the longest password is "pass007" and its length is 7.
Write a function:
int solution(String spaceSeparatedPasswords);
After the rainfall, all the low-lying areas (i.e. blocks that have higher blocks on both sides) are holding as much water
as possible. You would like to know the maximum depth of water after this entire area is flooded. You can assume that
the altitude outside this area is zero and the outside area can accommodate infinite amount of water.
For example, consider array A such that:
A[0] = 3
A[1] = 1
A[2] = 2
Its maximum depth will be 1. Since A[0] and A[2] are higher than A[1]. So maximum depth is 1. Cause highest level and lowest level is 2 - 1 = 1. So surface will look like:
___
| | 1 ___
| |___| |
| | | |
Write a function which apply only one parameter - array, which will describe 2D surface.
int solution(int[] surface);