Showing posts with label Nagarro. Show all posts
Showing posts with label Nagarro. Show all posts

March 25, 2015

Nagarro:GenerateNextDate

Question: Write a function char[] GenerateNextDate(char[]) such that if a date of the format "23Jan201 2" is input, the next date should be produced.

Eg: Input ­ "12-Dec-1987"
Output ­ "13-Dec-1987"
Please remember the input and output are both strings.

March 19, 2015

Nagarro : Theatre Seat Planing


Question :Write a function for seat allocate and seat reserved.Seat allocate array and seat reserver array.Seat allocate array is of 10*20 and each row and column represent A1 ,A2....;B1 ,B2.....;........J1 ,J2... and so on i.e row are A to J whereas col starts from 0 to 1 9.Each cell in the table represent either 0 or 1 . 0 rep seat available , 1 rep  seat reserved. Seat allocation starts from highest to lowest.And row j is highest, i is second highest and so on.Max 20 seats can be booked at a time. 

if seat is available print the seat no like "B2" i.e (2 row, 3 col)and seat is booked." otherwise Print "Seat is not available."

March 18, 2015

Nagarro :Resort the array taking absolute value of negative numbers

Question: You are given a sorted array containing both negative and positive values. Resort the array taking absolute value of negative numbers. Your complexity should be O(n)
 Ex. A = {-8,-5,-3,-1,3,6,9} Expected Output: {-1,-3,3,-5,6,-8,9}

March 15, 2015

Nagarro:Minimum no of counts from the knight to reach the king?

Question. A chessboard was given to us. Where in there was a Knight and King was placed on certain positions. Our aim is to reach the king from the knight in minimum no of counts.As we know, knight can either move 2 steps vertical/horizontal and 1 step horizontal/vertical. same goes here as well. Proper image of the chess board was given in the question paper, and all the positions(max 8) were given that knight can take in the first step.

Nagarro: check whether combination of paranthis is valid or not?