SoFi Interview Questions
Showing 17 questions
Determine the fewest character replacements needed to transform one string into an anagram of another. Essentially, find the minimum steps to make two strings have the same character frequencies.
#1. Minimum Number of Steps to Make Two Strings Anagram
Find the smallest substring within a larger string that contains all the characters of a target string. You need to locate the minimum window that satisfies this condition.
#2. Minimum Window Substring
Find the length of the longest 'mountain' (increasing then decreasing sequence) within an array of numbers. The mountain must have at least 3 elements.
#3. Longest Mountain in Array
Design a data structure that supports insertion, deletion, and random element retrieval, all in constant time on average. You'll need to handle edge cases carefully to achieve O(1) complexity.
#4. Insert Delete GetRandom O(1)
Given a grid representing land and water, count the number of distinct islands. An island is formed by connected land cells.
#5. Number of Islands
You're given a list of asteroids, each with a size and direction (positive is right, negative is left). Figure out which asteroids will survive after all collisions happen.
#6. Asteroid Collision
Find the k most frequent elements in a given array of numbers. Return the top k elements based on their frequency.
#7. Top K Frequent Elements
Find the maximum number of non-overlapping palindrome substrings you can create from a given string. Each substring must be a palindrome, and no two substrings can overlap.
#8. Maximum Number of Non-overlapping Palindrome Substrings
Find the smallest subarray within a given array that has the same degree as the entire array. The degree is defined as the highest frequency of any element.
#9. Degree of an Array
You are given k sorted lists. Combine all of their elements into a single sorted list and return it.
#10. Merge k Sorted Lists
Find two numbers in a given array that add up to a specific target value, and return their indices. Essentially, you need to efficiently locate the pair that satisfies the sum requirement.
#11. Two Sum
Design a data structure that acts as a Least Recently Used (LRU) cache. Implement methods to get and put key-value pairs, evicting the least recently used entry when the cache is full.
#12. LRU Cache
Convert a Roman numeral string into its corresponding integer value. The input string will represent a valid Roman numeral.
#13. Roman to Integer
Imagine people in a circle, eliminating every kth person. Determine who is the last person remaining after this process.
#14. Find the Winner of the Circular Game
You are given a list of meeting time intervals. Determine the minimum number of conference rooms required to accommodate all the meetings without any overlap.
#15. Meeting Rooms II
Find the number of palindromic substrings within a given string. Consider each single character and repeated characters as a substring.
#16. Palindromic Substrings
Find the number of contiguous subarrays within a given array whose product is strictly less than a target value k. The goal is to efficiently count these subarrays by considering the product of their elements.
#17. Subarray Product Less Than K