Tesla Interview Question

Asked to implement certain functions in C language