smit
BAN USER- 4of 4 votes
Answersgiven an 2D matrix M, is filled either using X or O, you need to find the region which is filled by O and surrounded by X
- smit in India
and fill it with X.
example 1:
X X X X X
X X O O X
X X O O X
O X X X X
Answer :
X X X X X
X X X X X
X X X X X
O X X X X
example 2:
X X X X X
X X O O X
X X O O O
O X X X X
answer 2:
X X X X X
X X O O X
X X O O O
O X X X X| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 4 votes
AnswersGiven an array of n elements (a1,a2,..ai,...,an). You are allow to chose any index i and j, such that (i!=j) and allow to perform increment operation on ai = ai+1 and decrements operation on aj = aj - 1 infinite number of times. How many maximum number of elements you can find that have same number.
- smit in India
example 1:
1 4 1
ans: 3
example 2:
2 1
ans : 1| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 0of 2 votes
AnswersGiven an array of n elements (a1,a2,..ai,...,an). You can allow to chose any index i and j, such that (i!=j) and allow to perform
- smit in India
increment operation on ai = ai+1 and decrement operation on aj = aj-1 infinite number of times.
How many number of elements you can find which have same numbers.
example 1:
1 4 1
ans: 3
example 2:
2 1
ans : 1| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer