Question: write a program that accepts two mandatory arguments without using any built in date or time functions . The first argument is a string "[HH:MM {AM|PM}" and the second argument is an integer Which denotes minutes. The minutes get added to the string. The return value or output of the program should be a string of the same format as the first argument. For example AddMinutes("10:23 AM", 13) would return "10:36 AM

Solution: Easy question But keep boundary condition in mind.
let from first argument we get hh, mm and meridian = {AM = 0, PM = 1}. from second argument we get x the minutes to be added.
1. mm = (mm+x)%60;
2. hh = ((mm+x)/60+hh)%24
3. if (hh > 12) { meridian = 1-meridian; hh %= 12;}