两道google的题# JobHunting - 待字闺中
g*r
1 楼
1. Given a array of integers , find 3 indexes i,j,k such that, i<
j 这个怎么搞呢,O(n)可能吗?
2.You are given an array of n elements [1,2,....n]. For example {3,2,1,6,7,4
,5}.
Now we create a signature of this array by comparing every consecutive pir
of elements. If they increase, write I else write D. For example for the
above array, the signature would be "DDIIDI". The signature thus has a
length of N-1. Now the question is given a signature, compute the
lexicographically smallest permutation of [1,2,....n]. Write the below
function in language of your choice.
j
2.You are given an array of n elements [1,2,....n]. For example {3,2,1,6,7,4
,5}.
Now we create a signature of this array by comparing every consecutive pir
of elements. If they increase, write I else write D. For example for the
above array, the signature would be "DDIIDI". The signature thus has a
length of N-1. Now the question is given a signature, compute the
lexicographically smallest permutation of [1,2,....n]. Write the below
function in language of your choice.