Convert M/B Amount Strings to Numbers
Updated
Problem statement
The amounts table contains a unique id and a text value amount_text. Convert each text value into its numeric amount in base units. Return columns id and amount, ordered by id ascending.
For this exercise, assume the text contains an unsigned decimal coefficient followed immediately by uppercase M or B. M means one million and B means one billion. Multiply the coefficient by the matching magnitude.
The coefficient has one to seven digits before an optional decimal point, followed by one or two fractional digits when the point is present. Leading zeros are allowed. There are no signs, spaces, commas, or currency prefixes. All input values follow this format. Because there are at most two fractional digits, every expanded amount is an exact integer.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
amounts
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | Integer | No | Unique positive record ID. |
| amount_text | Text | No | Valid unsigned decimal coefficient followed by M or B. |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | Integer | No | — |
| amount | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- For this exercise, assume the table contains 0 to 100 rows.
- IDs are unique integers from 1 through 1000000000.
- Coefficients are between 0 and 1000000, inclusive.
- Every amount_text value follows the stated ASCII decimal-plus-suffix format and has at most 11 characters.
- Neither column is NULL. The expanded amount is at most 1000000000000000.
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
- Maximum Square-Free DivisorOA · 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
Similar questions at other companies
- Students Scoring Above AverageCapstone Investment Advisors · OA
- Bond Interest Summary Above 3%Wells Fargo · OAWells Fargo interview questions
- Students and Their SubjectsBirla Pivot · OA
- Companies with Average Salary Above 40000AT&T · OAAT&T interview questions
- Build Taxi Driver Performance FeaturesBoston Consulting Group · OABoston Consulting Group interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Companies Above a Salary ThresholdVerisk · OA
- Customer Resource Usage AnalysisIBM · OAIBM interview questions
- Customers Who Never OrderedAccenture · OAAccenture interview questions
- First Duplicate Transaction Within Ten MinutesLenskart · OA