Lucky Ticket
Easy
math
digit-manipulation
Problem Description
Given a 6-digit number, determine if it's "lucky". A ticket is lucky if the sum of the first 3 digits equals the sum of the last 3 digits.
Input Format
A single 6-digit number (may have leading zeros).
Output Format
Return "Lucky" if the ticket is lucky, "Not Lucky" otherwise.
Constraints
Input is always a 6-digit number
000000 <= number <= 999999
Sample Input/Output
Input:
123321
Output:
Lucky
Explanation
First 3 digits: 1+2+3 = 6. Last 3 digits: 3+2+1 = 6. Since 6 = 6, the ticket is lucky.
Solution Hints
- Read carefully: Understand input/output format and constraints
- Start simple: Think of brute force solution first, then optimize
- Edge cases: Consider empty inputs, single elements, max constraints
- Data structures: Choose arrays, hash maps, sets based on problem needs
- Time complexity: Ensure your solution fits within time limits
- Test examples: Verify logic with provided sample inputs
60
Points
Points
2000ms
Time Limit
Time Limit
256MB
Memory Limit
Memory Limit
Code Editor
Register to Access Code Editor
Create a free account to solve coding problems and track your progress.
Register Now