Posts

BONUS PRACTICE PROBLEMS

Bonus Practice Problems(GMT To IST) IST (Indian Standard Time) is 5 hours 30 minutes ahead of GMT(Greenwich Mean Time). Develop an algorithm and write the Python code to find day and IST, given day and time in GMT. For example, if day is Sunday and time in GMT is 23:05 then in IST is Monday (Next day) and time is 04:35. Check boundary conditions and print 'Invalid input' for wrong input. Write appropriate functions for accomplishing the task. Use rstrip() to remove extra spaces while reading strings Input Format Day Hours minutes of time in GMT Output Format Day Hours minutes of time in IST Boundary Condition: All hour > 0 and <24 Minutes > 0 and < 60 Seconds > 0 and <60 Day is Sunday or Monday or Tuesday or Wednesday or Thursday or Friday or Saturday Input: Take the input serially as day,hours and minutes. Processing Involved: days=["Sunday","Monday","Tuesday","Wednesday"...

PRACTICE PROBLEM 8

Image
PRACTICE PROBLEM 8 Verification of 'L' shaped arrangement of Coins on Game Board (Id-2435) Consider a nxn board game with four types of coins red, green, blue and yellow. Given the state of the board with coins in all cells, develop an algorithm and write a C program to check if the same coins are placed in ‘L’ shape on the board. The number of cells in the vertical and horizontal line of ‘L’ shape should be same and should be greater than 1. Red coins are represented by ‘r’, blue coins are represented by ‘b’, green coins are represented by ‘g’ and yellow coins are represented by ‘y’.  For example, given the configuration of a 4 X 4 board with coins as shown below, b r y r r r y b y r b b b r r r the program must print 'Yes'. As there is a 'L' shape as shown in the figure below. Input Format Number of rows, r Number of columns, c Next ‘r x c’ lines contains the elements in the matrix Elements in the matrix given row by row ...