Retired

Maximal Divisor - best complexity (retired)

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

Stats:

CreatedAug 24, 2021
Warriors Trained102
Total Skips18
Total Code Submissions173
Total Times Completed55
Python Completions55
Total Stars2
% of votes with a positive feedback rating64% of 36
Total "Very Satisfied" Votes19
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes9
Total Rank Assessments37
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Mikaello Avatar
Ad