Round 1:- Telephonic round with collabedit
-All basic and tricky question related to dns, shell , pattern, linux, python , debugging and puzzle
Round 2:- face2face Technical round with 1 person-Clear
-same as round 1 but explained on board.
Round 3:- Technical round with 2 person
-Programming skill check , Program writting for sorting, occurance and tricky and mathematical puzzle.
Round 4: :-Technical round
2nd Question:-"Write a program to grep the pattern from the file and return the line number which has maximum 1.
0110101010010
1101010010101
0110101111111
1111111111100
0100101010010
1000001010100
I wrote:-
import io
r=open("file.txt",'w+')
r.write('0110101010010\n1101010010101\n0110101111111\n1111111111100\n0100101010010\n1000001010100')
r.close()
index=0
count=0
linenumber=0
val=''
for i in open("file.txt",'r'):
num1count=1
linenumber+=1
for j in range(len(i)):
print i[j]
if i[j] is '1':
num1count+=1
if count<num1count:
index=linenumber
count=num1count
val=i
print 'highest 1 index is ',index, 'and value is ',val
Question 3:- Can you optimize this.?
I tried to solve using pattern.search. with one for loop. I was not able to recall the syntax of it hence just explain the logic.
Question 4:Can you further optimize this?
I tried using re.match but i was not able to find the line number for highest number of 1.
Question 5:- Can you further optimize.
" I replied, This is what i am able to think as of now."