Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up

Power of (a^b)

Easy Acceptance 85.00% Points 20.00

Description: You are given two integers a and b. Your task is to find the value of a raised to the power b (a^b) and print the result.

Examples
Example 1

Example 1

Input: a = 2, b = 3

Output: 8

Explanation: 2^3 = 8

Example 2

Example 2

Input: a = 5, b = 4

Output: 625

Explanation: 5^4 = 625

Hints
Hint 1
N/A
Constraints
  • Constraints: 1 < a < 50
  • 0 < b < 50
Companies
Apple Samsung IBM
Topics
Recursion
Solution.cs C#JavaPythonC++Javascript

Unlock the code editor

Sign in to write, run, and submit your solution against the full test suite.

  • Run code against sample & hidden test cases
  • Save submissions and track your streak
  • Compare with editorial & community solutions