R

E

A

C

T

O

xamples 

epeat

ode

pproach

ptimize

est

{Clock Minute Adder}

The Question

Given:

  • a time in string format HH:MM
  • a number of minutes

Return:

  • The time given those minutes added to the base time

 

Assumptions:

  • You're working with a standard 12-hour clock
  • Output needs to match input format HH:MM

What output would you expect?

Examples

Examples

What output would you expect?

Solution

What is the purpose of adding and subtracting 1 on line 7?

Interviewer Tips

  • Main point here is modular math -- try to steer them there if they are using another approach
  • If time permits, remind them about destructured assignment and string interpolation 
  • Review at 10:15 will be a re-cap of this, no need to double up 😁

 

Clock Minute Adder

By mschreiber

Clock Minute Adder

Technical interview problem on finding the character index for every word that begins with a given string.

  • 866