FastPrepMaximum Square-Free Divisor
Problems/Maximum Square-Free Divisor

Maximum Square-Free Divisor

Intuit logoIntuit● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit full-time online assessment. Our task is about 99% the same as the report. The photographed explanation is cropped. The text that comes with it makes clear that the excluded perfect squares are greater than 1.

Your friend gives you a positive integer n. Find the largest positive divisor d of n that is not divisible by any perfect square greater than 1.

Equivalently, d must not be divisible by k^2 for any integer k >= 2. Such a number is called square-free. Return the maximum possible d.

Function

solve(n: long) → long

Examples

Example 1

n = 4return = 2

The divisors of 4 are 1, 2, and 4. The divisor 4 is divisible by the perfect square 4, while 2 is square-free. Return 2.

Example 2

n = 1return = 1

The only positive divisor is 1. No perfect square greater than 1 divides it, so return 1.

Example 3

n = 72return = 6

72 = 2^3 * 3^2. A square-free divisor can use at most one factor of 2 and one factor of 3. Taking both gives the largest valid divisor, 6.

Constraints

  • 1 <= n <= 10^12.
  • The input and return value use signed 64-bit integers.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026
  • Alien DictionaryOA · Seen Sep 2026

Similar questions at other companies

  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Counting Cows by Their LegsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions
  • Minimum Testers to Find the Poisoned BottleWalleye Capital · OA

Interview reports that mention this question

  • Intuit OA: What It Tests (2026)

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public long solve(long n) {
        // write your code here
    }
}
Checking account…