Minimum time difference

Minimum time difference Given a list of 24-hour clock time points in “HH:MM” format. Write a program to find the minimum minutes difference between any two time-points in the list. Example:  Given hours: [00:00, 03:00, 22:30] minimum time difference: 90 Given hours: [01:59, 03:00, 21:50, 22:30] minimum time difference: 40 Solution: Convert all the given … Read more Minimum time difference

Duplicate zero’s without expanding the array.

Given an array of numbers, you need to duplicate the zero’s in the array. Do not extend the size of array, just discard the remaining elements (had array gets extended, those elements) after the array size. Example:  Input: [1, 0, 2, 3, 0, 4, 5, 0] Output: [1, 0, 0, 2, 3, 0, 0, 4] … Read more Duplicate zero’s without expanding the array.

Replace Elements with Greatest Element on Right

Given an array of numbers nums[], write ment a function to replace each element of the array with the greatest element present to its right side. Replace the last element with -1.  Example: Input: [4, 5, 2, 25, 13, 16, 8] Output: [25, 25, 25, 16, 16, 8, -1] Input: [4, 5, 2, 25, 13, … Read more Replace Elements with Greatest Element on Right