Sofi Software Engineer Onsite Coding Questions
11+ questions from real Sofi Software Engineer Onsite Coding rounds, reported by candidates who interviewed there.
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
Sofi Onsite 4-Round Fulltime SDE Interview Experience
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.
#380 Insert Delete GetRandom O(1)
LeetCode #380: Insert Delete GetRandom O(1). Difficulty: Medium. Topics: Array, Hash Table, Math, Design, Randomized. Asked at SoFi in the last 6 months.
SoFi SWE Onsite - Binary Search Tree
## 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.
Goldbar Sharing: Distribute Gold Bars Among Players to Minimize Maximum Envy
## 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?
## Round 1 - Frontend ## Problem Build a Kanban board component in React with three columns: **To Do**, **In Progress**, **Done**. Each task card shows a title and priority badge. Users can drag cards between columns; the drop target column highlights on hover. ```tsx type Task = { id: string; title: string; priority: "low" | "medium" | "high" }; type Column = { id: string; label: string; tasks: Task[] }; function KanbanBoard({ initialColumns }: { initialColumns: Column[] }) { // implement } ``` **Requirements:** - Use only the HTML5 Drag and Drop API (no external library). - State is managed locally; no backend calls needed. - Dragging a card out of a column removes it there and inserts it at the drop position in the target. ## Follow-ups 1. How would you persist board state across page refreshes without a backend? 2. Two users edit the board simultaneously. What conflict resolution strategy would you use? 3. The board may grow to 500 tasks per column. How do you avoid rendering performance issues? 4. Add keyboard accessibility so cards can be moved without a mouse.
SoFi SWE Onsite - Longest Substring
## 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.
Rating System: Build an Interactive Star-Rating Component with Hover and Submission State
## 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)`.
See All 11 Questions from This Round
Full question text, answer context, and frequency data for subscribers.
Get Access