FastPrepSplit Integer and Fractional Parts
Problems/Split Integer and Fractional Parts

Split Integer and Fractional Parts

Squarepoint Capital logoSquarepoint Capital● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Squarepoint Capital new-grad phone screen. The report asks you to separate the integer and fractional parts of a number, but gives no code, number type or precision. We chose exact decimal text, rounding toward zero, one exact string form for the results, the examples and the limits. The exact interview date is unknown. Our version is about 50% the same as the reported question.

Separate the finite decimal number in value into its integer and fractional parts.

For this exercise, assume the input is exact decimal text, with an optional minus sign, one or more integer digits, and an optional decimal point followed by one or more fractional digits. Leading and trailing zeros are allowed. There is no plus sign, exponent or whitespace.

The integer part is truncated toward zero. The fractional part is the input value minus that integer part. Return exactly two strings in the order [integerPart, fractionalPart].

Write the integer part without leading zeros. Write a nonzero fractional part as 0. followed by its digits, with a minus sign when it is negative, and remove trailing zeros. Represent every zero part as 0, without a minus sign or decimal point. The two returned values must add up exactly to the input value. Do not round through a binary floating-point type.

Function

splitDecimalParts(value: String) → String[]

Examples

Example 1

value = "12.3400"return = ["12", "0.34"]

The integer part is 12 and the remaining value is 0.34. Removing fractional trailing zeros preserves the exact sum.

Example 2

value = "-0.125"return = ["0", "-0.125"]

Truncating toward zero gives integer part 0. The entire negative value is the fractional part, so the two parts still add up to -0.125.

Example 3

value = "-007.000"return = ["-7", "0"]

Leading integer zeros are removed. The fractional part is exactly zero, which is written as 0 without a sign.

Constraints

  • 1 <= value.length <= 102
  • The input matches -?[0-9]{1,50}(\.[0-9]{1,50})? in full.
  • The characters are ASCII digits, with only the optional minus sign and decimal point shown above.

More Squarepoint Capital Phone Screen questions

  • Newton Square Root to a Guaranteed TolerancePHONE SCREEN · Seen Nov 2026
  • Probability of Consecutive HeadsPHONE SCREEN · Seen Nov 2026
  • Three Points in a Semicircle: Monte Carlo EstimatePHONE SCREEN · Seen Nov 2026
  • Combine Two Index SequencesPHONE SCREEN · Seen Aug 2026
  • Parse, Normalize, and Combine PolynomialsPHONE SCREEN · Seen Aug 2026
  • Sorted Insertion SnapshotsPHONE SCREEN · Seen Aug 2026
  • Strong and Weak Reference LifecyclePHONE SCREEN · Seen Aug 2026
  • Target Sum Across Two Sorted ArraysPHONE SCREEN · Seen Aug 2026
  • Classify Heap Addresses from a Memory SnapshotPHONE SCREEN · Seen Nov 2025
  • Fixed Worker Pool with a Shared QueuePHONE SCREEN · Seen Nov 2025

Similar questions at other companies

  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN
  • Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesStripe · PHONE SCREENStripe interview questions
  • Roman to IntegerKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Minimum Difference Between Two Clock TimesMicron Technology · PHONE SCREEN
  • Decimal Digits in OrderZoomInfo · PHONE SCREEN
  • Fizz and Buzz Words From 1 to nDocuSign · PHONE SCREENDocuSign interview questions
  • Integer to String Without Built-insHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Excel Sheet Column TitleUiPath · PHONE SCREEN

Interview reports that mention this question

  • Squarepoint Campus SDE Interviews: 7 Experiences (Part 2 of 2)

Squarepoint Capital interview experiences

  • Squarepoint Capital C++ and Python SWE Interviews: 7 Experiences
  • Squarepoint Capital New Grad SDE OA: 5 Experiences (Part 1 of 2)
All Squarepoint Capital interview questionsSee Squarepoint Capital hiring insights
Saved
class Solution {
    public String[] splitDecimalParts(String value) {
        // write your code here
    }
}
Checking account…