Floor Square Roots for an Array
Updated
Problem statement
Given an array of nonnegative integers values, return an array where result i is the floor square root of values[i].
For a number x, its floor square root is the largest integer r such that r * r <= x.
Function
floorSquareRoots(values: int[]) → int[]Examples
Example 1
values = [0,1,4,9,16]return = [0,1,2,3,4]Every value is a perfect square.
Example 2
values = [2,8,15,26]return = [1,2,3,5]Each result is rounded down to the largest integer whose square does not exceed the input.
Example 3
values = [2147395600,2147483647]return = [46340,46340]Both values have floor square root 46340; multiplication must avoid 32-bit overflow.
Constraints
1 <= values.length <= 10^5.0 <= values[i] <= 2^31 - 1.
More Wells Fargo Online Assessment questions
- Server Upgrade PlanningOA · Seen Nov 2026
- Student and Course EnrollmentOA · Seen Nov 2026
- Bond Interest Summary Above 3%OA · Seen Oct 2026
- Count Phrases Formed by Anagram ReplacementOA · Seen Oct 2026
- Event Statistics AggregatorOA · Seen Sep 2026
- Ordered Deployment Configuration ValidatorOA · Seen Sep 2026
- Longest Subsequence That Is a SubstringOA · Seen Jul 2026
- Overloaded Game Account InventoriesOA · Seen Jul 2026
- Count Server ReplacementsOA · PHONE SCREEN · Seen Feb 2026
- Minimum Remaining LengthOA · PHONE SCREEN · Seen Feb 2026
Similar questions at other companies
- Maximum Alloy Production Within BudgetMicrosoft · OAMicrosoft interview questions
- Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
- Rock JumpingIMC Trading · OAIMC Trading interview questions
- Souvenir Shop PurchasesAmazon · OA
- TikTok Video Relevance AdjustmentTikTok · OATikTok interview questions
- Pressure Chamber Linear InterpolationSpaceX · PHONE SCREENSpaceX interview questions
- Random Pick with Weight Using Recorded DrawsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Koko Eating BananasTekion · ONSITE INTERVIEWTekion interview questions
- Minimum of a Convex FunctionRippling · PHONE SCREENRippling interview questions
- Count Centaur Friend RequestsMeta · PHONE SCREENMeta interview questions