Challenge 1: Compute Square of a Number
Given a number, implement a function to compute the square of that number.
We'll cover the following
Problem Statement
Implement a function that takes a specific number testVariable
and returns the square of the number.
Use the following mathematical identity to solve this problem: .
Remember to implement your solution recursively.
Input
A variable testVariable
that contains the input number
Output
The square of the input number
Sample Input
5
Sample Output
25
Try it Yourself!
Try this challenge yourself before examining the solution. Good luck!
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.