Sofi

Sofi Software Engineer Onsite Coding Questions

41+ questions from real Sofi Software Engineer Onsite Coding rounds, reported by candidates who interviewed there.

41
Questions
8
Topic Areas
10+
Sources

What does the Sofi Onsite Coding round test?

The Sofi onsite coding round is the core technical evaluation. Software Engineer candidates typically see 2-3 algorithm and data structure problems. Problems range from medium to hard difficulty, and interviewers evaluate both correctness and code quality.

Top Topics in This Round

Sofi Software Engineer Onsite Coding Questions

The following content requires a score higher than 220. You can already view it. The first round only allowed Java; no other languages were permitted. The interviewer added other languages, which migh

LeetCode #347: Top K Frequent Elements. Difficulty: Medium. Topics: Array, Hash Table, Divide and Conquer, Sorting, Heap (Priority Queue), Bucket Sort, Counting, Quickselect. Asked at SoFi in the last 6 months.

LeetCode #380: Insert Delete GetRandom O(1). Difficulty: Medium. Topics: Array, Hash Table, Math, Design, Randomized. Asked at SoFi in the last 6 months.

## Problem Implement or operate on a Binary Search Tree with operations like insert, delete, search, or validate BST property. ## Likely LeetCode equivalent Similar to Validate BST (LC 98) or operations on BST nodes. ## Tags binary_tree, binary_search, sofi

## Problem Find the minimum number of character changes required to make two strings anagrams of each other. ## Likely LeetCode equivalent Similar to Minimum Number of Steps to Make Two Strings Anagram (LC 1347). ## Tags strings, hash_table, sofi

## Problem Given an integer array `nums`, find the length of the longest contiguous subarray that contains no duplicate values. ```python def clean_subarray(nums: list[int]) -> int: pass ``` **Example:** ``` nums = [2, 1, 3, 1, 4, 3, 5] output -> 4 # subarray [1, 4, 3, 5] or [3, 1, 4, 3] -- wait, [1,4,3,5] is the answer nums = [1, 1, 1] output -> 1 ``` ## Approach Sliding window with a hash set. Expand `right`; when a duplicate is found, shrink from `left` until the duplicate is evicted. O(n) time, O(k) space where k is the window size. ## Follow-ups 1. Return the actual subarray, not just its length. 2. What if "clean" means at most k distinct elements instead of zero duplicates? 3. How does your solution behave on a sorted vs. random array -- any optimization possible? 4. Extend to a 2D matrix: find the largest rectangular sub-matrix with no repeated value in any row.

## Problem You have `n` gold bars with given weights and `k` players. Distribute all bars among the players such that the difference between the heaviest and lightest player's total is minimized. Each bar goes to exactly one player. ```python def goldbar_sharing(weights: list[int], k: int) -> int: # Returns the minimum possible (max_total - min_total) pass ``` **Example:** ``` weights = [3, 1, 4, 2, 5], k = 2 # One split: [3,2,1]=6 vs [4,5]=9 -> diff 3 # Better: [5,1]=6 vs [4,2]=6 -- wait: [5,1]=6, [3,2]=5, [4]=4 for k=3 # For k=2: [5,2]=7 vs [4,3,1]=8 -> diff 1 output -> 1 ``` ## Follow-ups 1. Is this problem NP-hard in general? What constraints make it tractable (e.g., small n, small k)? 2. How would you approach this with dynamic programming if `n <= 20`? 3. Discuss a greedy approximation: assign each bar to the player with the current lowest total. When does it fail? 4. If players have capacity limits on the total weight they can carry, how does that change the solution?

## Problem Find the longest substring without repeating characters using a sliding window approach. ## Likely LeetCode equivalent Directly matches Longest Substring Without Repeating Characters (LC 3). ## Tags sliding_window, strings, hash_table, sofi

## Problem You have a `purchases` table. Find all users who made at least one purchase in every calendar month of the year 2023. ```sql -- Table: purchases -- user_id INT -- purchase_date DATE -- amount DECIMAL SELECT user_id FROM purchases WHERE YEAR(purchase_date) = 2023 GROUP BY user_id HAVING COUNT(DISTINCT MONTH(purchase_date)) = 12 ORDER BY user_id; ``` **Example result:** ``` user_id ------- 101 334 ``` ## Follow-ups 1. Rewrite the query to work for any year passed as a parameter, not just 2023. 2. The business defines "loyal" as purchasing in 10 or more of 12 months. Adjust the query. 3. Some users have duplicate purchases on the same day. Does your query still return the correct result? Why? 4. Write a Python equivalent using `pandas` groupby that produces the same output from a DataFrame.

## Round 1 - Frontend ## Problem Build a `StarRating` component in React. It renders 5 stars. On hover, stars up to the hovered index light up. On click, the rating is locked in and a confirmation message appears. Provide a callback `onRate(rating: number)` prop. ```tsx function StarRating({ onRate, defaultRating = 0, }: { onRate: (rating: number) => void; defaultRating?: number; }) { // implement } ``` **Requirements:** - Hover state is separate from submitted state. - After submission the stars are read-only. - Stars are keyboard-accessible (arrow keys change selection, Enter submits). - No external icon library; use Unicode stars or SVG. ## Follow-ups 1. How do you make the component controlled vs. uncontrolled? Which is better for a form? 2. Add half-star precision. How does the event handling change? 3. The rating must round-trip from a backend. How do you handle a stored value of `3.7` -- snap to nearest half? 4. Write a unit test using React Testing Library that verifies clicking the 4th star fires `onRate(4)`.

## Problem You are given text logs for multiple vehicles (each record includes a license plate and an event type). Event types are: `entry`, `road`, `exit`. A **trip** is counted when the **same plat

Given an `m x n` integer matrix `mat` where each row is sorted in **non-decreasing** order, find the smallest integer that appears in **every row**. - Return the smallest such integer if it exists. -

## Task: Implement Button-Triggered Fetch + Lazy Loading in Vanilla JavaScript (No Frameworks) On a simple web page (you may build on the previous HTML structure), implement **vanilla JavaScript** lo

## Task: Build a Search Bar UI Using Only HTML + CSS (No Frameworks) Implement a search bar UI using **only HTML and CSS** (no frameworks or component libraries). ### Functional & structural require

## Problem: K-th Unique Maximum from Two Sorted Arrays Given two **ascending sorted** integer arrays `A` and `B` (each may contain duplicates) and an integer `K`, return the `K`-th element in the seq

### Coding: Monte Carlo probability that an in-progress run matches or beats the personal best You are implementing a statistics system for obstacle-course racing. - A `Course` has `obstacle_count`

## Problem: Find the Second Most Frequent Tag from a Flattened String List You are given a string list `arr` whose elements repeat in the following fixed order: ``` [id1, name1, tag1, id2, name2, ta

## Problem: Design and Implement an Extensible Multi-threaded Task Executor (Semaphore-based) You are given a Java `TaskExecutor` skeleton and must implement a **multi-threaded task executor** using

A highway has multiple sensor locations: **entry**, **exit**, and intermediate **checkpoints**. Each sensor logs when a car passes. You are given time-ordered logs `logs`. Each log entry indicates th

You are given an existing JavaScript implementation and its unit tests. At least one test is failing. Tasks: - Read the code and tests - Identify why the test fails - Fix the code so that all tests p

What to Expect in the Sofi Onsite Coding Round

The Sofi Software Engineer Onsite Coding round has a specific calibration purpose distinct from other rounds in the loop. Across 41+ verified reports on LeakCode for this exact round type, the consistent expectations: clear scoping of the problem before diving into a solution, explicit reasoning about complexity, structured handling of edge cases, and the ability to discuss trade-offs between two reasonable approaches.

Reports tagged with the Onsite Coding round at Sofi show recurring patterns in difficulty and topic distribution. The Onsite Coding round is typically 45-60 minutes; the interviewer is calibrated against a specific rubric. The discriminator between candidates who advance and candidates who do not is rarely the final correctness of the answer. It is the path: did you clarify, did you verbalize your approach, did you handle edge cases, and did you communicate throughout.

How To Prepare for This Specific Round

Filter the questions below to the most recent reports (past 6-12 months). Questions tagged for this exact round type from this exact company at this exact role level are the highest-signal data available. Older reports may reference questions that have since rotated out of the company's pool.

Practice 4-6 representative problems from this set under timed conditions. The goal is not memorization (companies rotate questions); the goal is to internalize the patterns the interviewer typically reaches for and the depth of follow-up to expect. Reports on LeakCode also tag the typical follow-up depth at this round type, which is the discriminating signal between hire and no-hire calibration.

Onsite Coding Round Timing and Format

The Onsite Coding round at Sofi typically runs 45-60 minutes. Use the first 2-3 minutes to clarify requirements; you should never start coding or designing without verifying the input/output format, constraints, and edge cases out loud. Use the next 5-7 minutes to verbalize your approach before writing any code. The middle 20-30 minutes are implementation. Reserve the final 10 minutes for testing with concrete examples and discussing optimization or trade-offs.

Time budget discipline is one of the most reliable senior-vs-junior discriminators in this round. Strong candidates verbalize where they are in their budget out loud ("I've used about 20 minutes, I have 15 minutes left for testing and one optimization"). This signals engineering maturity to the interviewer and creates positive feedback they can capture in writing.

Common Failure Modes in This Round

Reports tagged "no hire" at Sofi Software Engineer Onsite Coding commonly cite: coding silently without verbalizing approach, jumping to implementation before clarifying requirements, missing edge cases (empty input, single element, very large input), producing working code that the candidate cannot refactor when asked, and failing to test their solution with concrete examples before declaring done.

The single most predictive failure mode in 2025-2026 reports: not asking clarifying questions. Interviewers at all FAANG companies are explicitly trained to weight this dimension. Strong candidates ask 3-5 clarifying questions even on problems that look obvious; weak candidates dive into code immediately. The clarifying-question check is often the first signal recorded in the interviewer's notes.

See All 41 Questions from This Round

Full question text, answer context, and frequency data for subscribers.

Get Access