MeetCode
Home
Doubts
Why is my C function not returning the …
Solved
1
49
Ask Doubt
View All Doubts
Solvers Leaderboard
Tutorials
Quiz
All Tests
Leaderboard
My Tasks
User Login
Dark
Enable Notifications
Toggle navigation
LCM Of Array Small
Computer Mathematics
Hard
2 views
Back to Questions
View Answer
0
Previous
GCD Of Array
Medium
P
Next
Are Coprime
Easy
N
Problem Description
Given n
Input Format
n then n integers.
Output Format
LCM or -1 if overflow.
Sample Test Case
Input:
3 2 3 5
Output:
30
Constraints
1
Official Solution
Iteratively compute lcm using gcd. If lcm > 1e18 at any step print -1.
Please
login
to submit solutions and comments.
Solutions (0)
No solutions submitted yet. Be the first!
Discussion (0)
No comments yet. Start the discussion!
Prev
Next
Fullscreen Editor
0 lines • 0 chars
Esc close • Tab indent
No comments yet. Start the discussion!