Ugly Number
Updated
Problem statement
Return whether n is a positive integer whose prime factors are limited to 2, 3, and 5. The number 1 is ugly because it has no prime factors.
Function
isUgly(n: int) → booleanExamples
Example 1
n = 6return = true6 equals 2 times 3.
Example 2
n = 1return = trueOne has no prime factors.
Example 3
n = 14return = falseThe factor 7 is forbidden.
Constraints
-2^31 <= n <= 2^31 - 1.
More SambaNova Systems Onsite Interview questions
- Vectorized K-Means AssignmentsONSITE INTERVIEW · Seen Apr 2024
- 4Sum II Tuple CountONSITE INTERVIEW · Seen Jun 2022
- Bomb Enemy Best CoordinatesONSITE INTERVIEW · Seen Jun 2022
- Sum Nodes with an Even-Valued GrandparentONSITE INTERVIEW · Seen Jun 2022
- Validate Binary Search TreeONSITE INTERVIEW · Seen Jun 2022
- Deterministic Zigzag SortPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
- Maximum Area of IslandONSITE INTERVIEW · Seen Jun 2022
- Task Scheduler with CooldownPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
- Point Inside a TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
- Parse Variable, Expression, and Application TreesPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
Similar questions at other companies
- Confusing Bib NumbersVerily · ONSITE INTERVIEW
- Sqrt(x)LinkedIn · PHONE SCREENLinkedIn interview questions
- Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
- Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
- Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesStripe · PHONE SCREENStripe interview questions
- Circular Primes Below a LimitAmazon · PHONE SCREEN
- Palindrome NumberKotak Mahindra Bank · PHONE SCREENKotak Mahindra Bank interview questions
- Streaming AverageXantium · PHONE SCREEN
- Plus OneDruva · ONSITE INTERVIEW
- Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions