Retired
Maximal Divisor - best complexity (retired)
55Mikaello
Description:
You are given some positive integer num (10^11 > num > 0).
Task is simple:
- try to find out the biggest divisor of this number (not including value itself) and return it;
- if it's a prime number, return 1.
Hint: you'll have some problems (12 seconds time exceeded) if not find best time complexity (must be significantly less then O(num)).
Examples:
if num equals 12, its biggest divisor will be 6
(we shoul choose maximum between 1, 2, 3, 4, 6, 12,
but not including the number itself, i.e. 12)
if num equals 7, its biggest divisor will be 1,
because it's a prime number
(we shoul choose maximum between 1, 7,
but not including the number itself, i.e. 7)
Fundamentals
Algorithms
Mathematics
Similar Kata:
Stats:
Created | Aug 24, 2021 |
Warriors Trained | 102 |
Total Skips | 18 |
Total Code Submissions | 173 |
Total Times Completed | 55 |
Python Completions | 55 |
Total Stars | 2 |
% of votes with a positive feedback rating | 64% of 36 |
Total "Very Satisfied" Votes | 19 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 37 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |