Microsoft SDE Intern Interview Experience
💼 LTIMindtree Interview Experience (On-Campus) | Fresher | 2026
Salesforce SMTS | Interview Experience | Rejected
JPMC | SDE2 (Associate) - Java Backend - Interview Experience + Compensation
Microsoft - SDE2 - Coding Round
Goldman Sachs Online Assessment Question | String | GCD | Maths
Summary
I recently encountered a problem during my Goldman Sachs Online Assessment related to simplifying fractions, which required applying GCD concepts.
Full Experience
During my recent online assessment for Goldman Sachs, I was presented with a problem that involved simplifying fractions. The core task was to take a string in the format "a/b" and reduce it to its lowest terms, ensuring the denominator remains positive. It was a straightforward implementation once the logic for handling negative numbers and using the greatest common divisor (GCD) was clear.
Interview Questions (1)
Problem: Simplify Fraction
You are given a string s in the form "a/b", where a and b are integers (which may be positive or negative).
Your task is to reduce the fraction into its lowest terms.
- If the fraction reduces to an integer, return the integer (as a string).
- If not, return the simplified fraction in the form
"p/q". - Ensure the denominator is always positive (move any negative sign to the numerator).
Examples
Input: "13/12"
Output: "13/12"
Input: "4/6"
Output: "2/3"
Input: "10/100"
Output: "1/10"
Input: "100/400"
Output: "1/4"
Input: "7/35"
Output: "1/5"
Input: "-12/13"
Output: "-12/13"
Input: "12/-4"
Output: "-3"
Input: "-8/-4"
Output: "2"