UHG interview questions

85 questions from 15 interviews · updated from reports 2016-2024

Practise UHG-style

About

UnitedHealth Group (UHG) is a health care and insurance company that offers health benefits and health services through businesses such as UnitedHealthcare and Optum. In India, it hires technical candidates for Software Engineer, Software Engineering Intern, and SDE-1 roles.

The roles that come up most are Software Engineer, Software Engineering Intern and SDE-1. This covers 15 candidate interviews reported from 2016 to 2024. Most sat it at entry level (9 of 15 that recorded a level), with 6 internship interviews alongside. Among the 14 that recorded either route, arrivals split between campus drives (13, 93%) and off-campus applications (1, 7%). Most questions fall under DSA and CS fundamentals.

Category
Difficulty
Round

Interview questions

Q. How would you optimize a recommendation system with O(n^3) time complexity to work efficiently on a large dataset?

asked 2xmediumOptimizationTechnical2019

Ans. Replace the cubic algorithm with a sparse, offline model such as matrix factorisation or item based collaborative filtering, then serve recommendations from precomputed top-k candidates. The key is to avoid comparing every user-item combination at request time. Use sparse matrices, approximate nearest neighbours, batching, and caching so online latency is near constant.

Q. Find the sum of all digits of a number repeatedly until the sum becomes a single digit.

asked 2xeasyMathOnline test2019

Ans. Use the digital root: if the number is 0, the answer is 0; otherwise the answer is 1 plus the remainder of number minus 1 divided by 9. This avoids repeated summing. No extra data structure is needed. The time complexity is O(1), compared with O(digits) per pass for simulation.

Q. Design a vending machine system

asked 1xmediumObject designTechnical2024

Ans. Design it as a state machine with states like idle, selecting item, accepting payment, dispensing, returning change, and out of service. Core components are inventory, payment handling, pricing, change management, dispenser, and controller. The most important detail is making payment and inventory updates transactional so money is not taken unless dispensing succeeds.

Q. Detect a cycle in a linked list

asked 1xmediumLinked listsTechnical2016

Ans. Use Floyd’s tortoise and hare algorithm: keep two pointers, one moving one node at a time and the other moving two nodes at a time. If they ever meet, there is a cycle. If the fast pointer reaches null, there is no cycle. It uses constant extra space and runs in O(n) time.

Q. Write SQL queries involving joins

asked 1xmediumSQLTechnical2021

Ans. Use joins by selecting columns from related tables and matching their keys in the join condition. For example, join customers to orders on customer id to return each order with its customer details. Use inner join for matching rows, left join to keep all rows from the left table, and filter with where.

Q. Explain how the C++ compiler works

asked 1xmediumCompiler designManagerial2021

Ans. A C++ compiler turns source code into an executable through preprocessing, parsing, semantic analysis, optimisation, code generation, assembly and linking. The key detail is that each source file is compiled as a separate translation unit, then the linker combines object files and libraries, resolving symbols such as functions and global variables.

Q. Write the Merge Sort algorithm/code

asked 1xmediumSortingTechnical2019

Ans. Merge sort is a divide and conquer sorting algorithm that splits the array into halves, sorts each half recursively, then merges the sorted halves. The key step is merging by comparing the smallest remaining elements. It runs in O(n log n) time and usually needs O(n) extra space.

Q. Explain the Huffman coding algorithm

asked 1xmediumAlgorithmsTechnical2016

Ans. Huffman coding builds an optimal prefix-free binary code by giving shorter codes to more frequent symbols. Count frequencies, put symbols in a min-heap, repeatedly remove the two least frequent nodes, merge them, and insert the parent. Label left and right edges 0 and 1. Building the tree takes O(n log n).

Q. Rotate a linked list in groups of k.

asked 1xmediumLinked listsOnline test2019

Ans. Use pointer manipulation to process each k-sized block independently: find the block boundary, rotate the nodes inside that block, then connect the previous block’s tail to the block’s new head and its new tail to the next block. A dummy head simplifies edge cases. This uses O(n) time and O(1) extra space.

Q. Explain the types of schedules in DBMS

asked 1xmediumDBMSTechnical2021

Ans. DBMS schedules are mainly serial schedules and non-serial schedules. In a serial schedule, transactions run one after another, so consistency is simple but concurrency is low. In a non-serial schedule, operations are interleaved for better performance. The important requirement is serializability, meaning the result matches some valid serial order.

Q. Rotate a linked list in groups of size k.

asked 1xmediumLinked listsOnline test2019

Ans. Split the list into consecutive groups of k nodes, rotate each group in place, then connect the rotated group back to the previous and next parts. The key detail is to keep pointers to the group’s previous node, head, tail, and next node. This takes O(n) time and O(1) extra space.

Q. Explain CPU scheduling in an Operating System

asked 1xmediumOperating systemsTechnical2024

Ans. CPU scheduling is the operating system’s method of choosing which ready process or thread gets the CPU next. It keeps the processor busy, improves responsiveness, and shares CPU time fairly. Common policies include First Come First Served, Shortest Job First, Priority, and Round Robin, each trading off throughput, waiting time, and fairness.

Q. Design a student registration management system

asked 1xmediumApplication designSystem design2020

Ans. Design it as a web service with student, course, section, prerequisite, enrolment and payment modules backed by a relational database. The most important detail is enforcing capacity and clash rules atomically during enrolment, using transactions, row locking or optimistic concurrency, so two students cannot take the last seat at the same time.

Q. Convert a binary tree into its mirror image in-place

asked 1xmediumTreesOnline test2016

Ans. Swap the left and right child of every node in the binary tree, modifying the existing nodes in-place. Do a depth-first traversal recursively, or use an explicit stack for iteration. At each node, swap its children, then process the children. Time complexity is O(n), and extra space is O(h) recursively.

Q. Find the distance between two nodes in a binary tree

asked 1xmediumTreesTechnical2021

Ans. Find the lowest common ancestor of the two nodes, then compute the distance from it to each node and add those distances. Equivalently, distance equals depth(a) plus depth(b) minus twice depth(LCA). Use a DFS to find the LCA and depths. Time complexity is O(n), with O(h) recursion space.

Q. Find the Longest Common Subsequence (LCS) of two strings

asked 1xmediumDynamic programmingOnline test2016

Ans. Use dynamic programming with a two-dimensional table where dp[i][j] stores the LCS length of the first i characters of one string and first j characters of the other. If characters match, extend the diagonal value; otherwise take the maximum from left or top. Time complexity is O(mn), with O(mn) space.

Q. Implement sorting of a 2-D array in the most optimized way

asked 1xmediumSortingTechnical2020

Ans. Flatten the 2-D array into a 1-D array, sort it using an efficient built-in comparison sort, then write the values back row by row. Use a dynamic array or vector to store the elements. For m rows and n columns, time complexity is O(mn log(mn)) and space is O(mn).

Q. Explain virtual functions and how the compiler works with them

asked 1xmediumOOPTechnical2021

Ans. Virtual functions are member functions resolved at run time, allowing a base class pointer or reference to call the derived class implementation. The compiler usually implements this with a vtable per class and a hidden vptr in each object. Calls use the vptr to find the correct function address dynamically.

Q. What are the advantages of NoSQL databases over SQL databases?

asked 1xmediumDBMSManagerial2020

Ans. NoSQL databases are often better for flexible schemas, large-scale horizontal scaling, and high-throughput access to semi-structured or unstructured data. They suit use cases where data shape changes often or traffic is distributed across many servers. The key advantage is scalability and flexibility, usually with weaker relational guarantees than SQL databases.

Q. Count all triplets in an array whose sum is equal to a perfect cube

asked 1xmediumArraysTechnical2021

Ans. Count triplets by first generating every perfect cube between the minimum and maximum possible triplet sums, then count triplets for each cube target. Sort the array, fix one element, and use two pointers to count pairs completing the sum, handling duplicates carefully. Time complexity is O(C n²), where C is the number of cubes.

Q. Find the Lowest Common Ancestor (LCA) of two nodes in a binary tree

asked 1xmediumTreesTechnical2021

Ans. Use a recursive depth first search: if the current root is null or equals either target node, return it. Search left and right subtrees. If both return non-null, the current root is the LCA; otherwise return the non-null side. This uses the call stack, with linear time and tree-height space.

Q. What are some recent technologies that use IoT, and what is the future scope of IoT?

asked 1xmediumNetworkingTechnical2019

Ans. Recent IoT technologies include smart home devices, wearable health monitors, connected cars, industrial sensors, smart agriculture, smart meters, and remote patient monitoring systems. The key future scope is wider automation using 5G, edge computing, AI, and cheaper sensors, enabling real-time decisions in cities, healthcare, transport, manufacturing, and energy management.

Q. Explain how a database works in a real-world application and how it is used in projects

asked 1xmediumDBMSTechnical2020

Ans. A database stores, organises and retrieves application data, such as users, orders, payments or messages. In a project, the application sends queries through a backend service to create, read, update or delete data. The most important detail is data consistency, usually handled with schemas, constraints, indexes and transactions.

Q. What is the difference between JSON and XML, and why is JSON preferred over XML in industry?

asked 1xmediumDBMSTechnical2019

Ans. JSON is a lightweight data format based on key value pairs and arrays, while XML is a markup language using nested tags and attributes. JSON is preferred because it is shorter, easier to read, maps naturally to objects in most languages, and is faster to parse for typical web APIs.

Q. Given a code snippet, identify whether it demonstrates runtime polymorphism or compile-time polymorphism.

asked 1xmediumOOPTechnical2023

Ans. It demonstrates runtime polymorphism if the method called is chosen at run time through overriding, usually via a base class or interface reference. It demonstrates compile-time polymorphism if the choice is resolved by the compiler, usually through method overloading or operator overloading. The key detail is whether binding happens at run time or compile time.

Q. If one pointer moves at speed 4 and another at speed 1 in a linked list, will they meet if there is a cycle?

asked 1xmediumLinked listsTechnical2016

Ans. Yes, if both pointers start from the head, they will meet if there is a cycle. Once both are inside the cycle, their relative speed is 3 nodes per step, so the faster pointer’s position advances modulo the cycle length until it lands on the slower pointer. Time is still linear.

Q. How would you implement MS Excel using data structures, supporting addition and deletion of rows and columns?

asked 1xmediumData structuresManagerial2021

Ans. Use a sparse table: store only non-empty cells in a map keyed by row and column, plus ordered row and column indexes. Insert or delete a row or column by updating the affected index ranges and shifting keys lazily through an offset structure. Cell lookup is near O(1); structural changes cost O(log n) plus affected cells.

Q. Explain what a Binary Search Tree (BST) is, its prerequisites, what a balanced BST is, and how to balance a BST

asked 1xmediumTreesTechnical2016

Ans. A Binary Search Tree is a binary tree where each node’s left subtree has smaller keys and its right subtree has larger keys. Its keys must be comparable, and duplicates need a defined rule. A balanced BST keeps height about log n, giving efficient search. It is balanced using rotations, as in AVL or Red-Black trees.

Q. How would you handle incorrect priority assignment in a recommendation system so that recommendations improve over time?

asked 1xmediumOptimizationTechnical2019

Ans. I would close the feedback loop by measuring outcomes for each priority decision and using that data to retrain or recalibrate the ranking model. The key detail is to log impressions, clicks, skips, conversions, dwell time, and negative feedback with context, then compare expected priority against actual user response and adjust weights safely through A/B tests.

Q. How would you handle incorrect priority weights in a recommendation system and adapt recommendations based on user behavior over time?

asked 1xmediumRecommendation systemTechnical2019

Ans. I would treat weights as learned, monitored configuration rather than fixed truth, and correct them through offline evaluation, A/B tests, and user feedback signals. The key detail is to close the loop: track clicks, skips, conversions, dwell time, and negative feedback, then regularly retrain or update weights with recency decay and guardrails.

Q. Count the total number of 1s present in a number; first for an integer, then extend the solution to handle a decimal (floating-point) number.

asked 1xmediumBit manipulationTechnical2020

Ans. Count digit 1 by scanning the number’s decimal representation and incrementing a counter whenever the character is 1. For an integer, repeated modulo and division also works. For a decimal, use its string form and ignore the decimal point and sign. Time is O(d), where d is the number of digits.

Q. Given a social network graph (like Facebook) implemented using adjacency lists, find the minimum degree of separation between two given people.

asked 1xmediumGraphsTechnical2019

Ans. Use breadth first search from the first person and stop when the second person is first reached. Store each visited person with their distance from the start in a queue, and mark visited nodes to avoid cycles. With adjacency lists, the time complexity is O(V + E).

Q. Given a continuous input stream of integers, how will you keep them sorted and print the output at any point in time? What data structure will you use?

asked 1xmediumData structuresTechnical2016

Ans. Use a self-balancing binary search tree, such as a Red-Black Tree or AVL Tree, storing counts for duplicate values. Each incoming integer is inserted in O(log n) time, and whenever output is needed, perform an in-order traversal to print all elements in sorted order in O(n) time.

Q. Solve quantitative aptitude problems involving geometry, heights and distances, permutations and combinations, probability, arrangements, and logical reasoning

asked 1xmediumQuantitative aptitudeOnline test2016

Ans. Identify the topic first, then write the known formula or rule before calculating. For geometry, draw the figure and mark values. For heights and distances, use trigonometric ratios. For permutations, check order; for combinations, ignore order. For probability, use favourable outcomes over total outcomes. For reasoning, spot patterns carefully.

Q. Given a graph representing a social network (like Facebook), find the minimum degree of separation between two given people. The graph is implemented using adjacency lists.

asked 1xmediumGraphsTechnical2019

Ans. Use breadth first search from the first person and stop when you reach the second person. Store visited people and their distance from the start in a queue. The first time you find the target gives the minimum degree of separation. With adjacency lists, the time complexity is O(V + E).

Q. Design a movie ticket booking platform

asked 1xhardScalable systemsTechnical2016

Ans. Use services for catalogue, showtimes, seat inventory, booking, payments, notifications and user accounts, backed by relational storage for bookings and a cache for read-heavy listings. The critical detail is seat consistency: hold selected seats with a short-lived lock, confirm only after payment succeeds, and release automatically on timeout or payment failure.

Q. Implement AVL tree balancing and explain all rotation cases

asked 1xhardTreesTechnical2020

Ans. Use a BST node storing key, left, right, and height, update height after insertion or deletion, compute balance as height(left) minus height(right), then rotate if it becomes outside -1 to 1. Cases are LL right rotation, RR left rotation, LR left then right, and RL right then left. Each update is O(log n).

Q. Maximize profit by buying and selling a stock at most k times.

asked 1xhardDynamic programmingTechnical2019

Ans. Use dynamic programming with two arrays: buy[t] is the best profit after buying in transaction t, and sell[t] is the best profit after selling transaction t. For each price, update buy and sell for t from 1 to k. If k >= n/2, use unlimited-transactions greedy. Time is O(nk), space is O(k).

Q. Maximize profit from stock prices when you are allowed to buy and sell stocks at most k times.

asked 1xhardDynamic programmingTechnical2019

Ans. Use dynamic programming with k transaction states to track the best profit after each buy and sell. If k is at least half the number of days, treat it as unlimited transactions and sum every positive price difference. Otherwise, update buy and sell arrays for each price. Time is O(nk), space is O(k).

Q. Design a personalized movie recommendation engine to suggest the (k+1)th movie to a user based on previously watched movies, without using ML libraries.

asked 1xhardRecommendation systemTechnical2019

Ans. Build an item based collaborative filtering service that scores unwatched movies from the user’s watched history and returns the highest ranked one as the k+1th recommendation. Store user to watched movies and movie to users inverted indexes, compute cosine or Jaccard similarity from co-watch counts, cache top similar movies per movie, then aggregate scores in near O(km).

Q. Design a personalized movie recommendation system to suggest the (k+1)th movie based on movies already watched, without using machine learning libraries.

asked 1xhardRecommendation systemTechnical2019

Ans. Build an item based recommender using watch sequences: for each movie, count which movies users watched next, then suggest the highest scoring unwatched movie after the user’s kth movie. Store counts in a sparse hash map keyed by movie to candidate movie. Update counts offline or streaming. Query time is O(c log c) or O(c) with precomputed top lists.

Q. Design a system to find trending words on Twitter based on frequency and timestamps, ignoring stopwords and special characters, and handling similar word variations.

asked 1xhardData processingTechnical2019

Ans. Build a streaming pipeline that normalises each tweet, removes stopwords and special characters, stems or lemmatises words, then updates per-word counts in time windows. Use Kafka for ingestion, stream processors for aggregation, and Redis or a time-series store for top words. The key detail is sliding-window counts with expiry, so trends reflect recent frequency, not lifetime popularity.

Q. Design a system to find trending words on Twitter based on frequency and recency, ignoring special characters and stop words, and treating similar elongated words as the same.

asked 1xhardData processingTechnical2019

Ans. Use a streaming pipeline that normalises each tweet, removes special characters and stop words, collapses elongated words such as “coooool” to “cool”, then updates word counts in sliding time windows. Rank words by a score combining frequency and recency, using time buckets with decay. Keep per-bucket hash maps and a top-k heap for fast queries.

Q. Reverse a linked list

asked 1xeasyLinked listsTechnical2021

Ans. Reverse a linked list by iterating through it and changing each node’s next pointer to point to the previous node. Keep three pointers: previous, current, and next, so you do not lose the rest of the list. At the end, previous is the new head. Time complexity is O(n), space complexity is O(1).

Q. Sort an array of integers

asked 1xeasySortingOnline test2020

Ans. Sort the integer array using a comparison sort such as merge sort. Recursively split the array into halves, sort each half, then merge the sorted halves back together using a temporary array. This gives O(n log n) time in all cases, with O(n) extra space.

Q. What is IoT (Internet of Things)?

asked 1xeasyNetworkingTechnical2019

Ans. The Internet of Things is a network of physical devices that contain sensors, software and connectivity so they can collect, send and sometimes act on data. The key idea is that everyday objects, such as thermostats, cars or factory machines, can communicate with systems or each other over the internet.

Q. Explain different sorting algorithms.

asked 1xeasySortingTechnical2020

Ans. Common sorting algorithms include bubble, selection and insertion sort for simple quadratic sorting, merge sort and heap sort for guaranteed O(n log n), and quicksort for fast average O(n log n). The key difference is trade-off: stability, memory use, and worst-case time. Merge sort is stable but uses extra space, while heap sort is in-place.

Q. Find the day of the week for a given date

asked 1xeasyLogical reasoningOnline test2019

Ans. Use the odd days method. Count odd days from a known reference date, such as 1 January 1900 being Monday. Add odd days for completed years, leap years, completed months, and the given date. Divide the total by 7. The remainder tells the weekday, counting forward from the reference day.

Q. Explain SQL concepts and write SQL queries

asked 1xeasySQLTechnical2023

Ans. SQL is used to define, read and change relational data stored in tables with rows and columns. Core concepts are primary and foreign keys, joins, filtering, grouping, aggregation, constraints, indexes and transactions. To write queries, choose the needed columns, join related tables, filter rows, group if required, and sort or limit results.

Q. Explain the difference between TCP and UDP

asked 1xeasyNetworkingManagerial2021

Ans. TCP is connection-oriented and reliable, while UDP is connectionless and faster but does not guarantee delivery. TCP orders packets, retransmits lost data, and provides flow and congestion control. UDP sends datagrams with minimal overhead, so it is useful for real-time traffic like video calls, gaming, DNS, or streaming where some loss is acceptable.

Q. Explain function overloading and recursion.

asked 1xeasyOOPTechnical2023

Ans. Function overloading means defining multiple functions with the same name but different parameter lists, while recursion means a function calls itself to solve smaller parts of a problem. Overloading is resolved by the compiler or runtime using the arguments. Recursion must have a clear base case to stop infinite calls.

Q. Check whether a given string is a palindrome

asked 1xeasyStringsTechnical2016

Ans. Use two pointers, one at the start of the string and one at the end, and compare characters while moving inward. If any pair differs, it is not a palindrome; if the pointers meet or cross, it is. This uses no extra data structure and runs in O(n) time with O(1) space.

Q. Which is the best sorting algorithm and why?

asked 1xeasySortingTechnical2020

Ans. There is no single best sorting algorithm, because the choice depends on the data and constraints. In practice, Timsort is often best for general-purpose library sorting because it is stable, fast on real-world partially sorted data, and has O(n log n) worst-case time. Quicksort is fast on average but not always stable.

Q. Write code to generate the Fibonacci series.

asked 1xeasyRecursionTechnical2023

Ans. Generate the Fibonacci series by starting with 0 and 1, then repeatedly adding the previous two numbers to get the next term until the required count is reached. Store the values in an array or list if they must be returned. The time complexity is O(n), with O(n) space, or O(1) if printed directly.

Q. What is a Virtual Function and why is it used?

asked 1xeasyOOPTechnical2019

Ans. A virtual function is a member function that can be overridden in a derived class and called through a base class pointer or reference. It is used to support runtime polymorphism, so the actual object type decides which implementation runs, not the declared type of the variable.

Q. Explain Inheritance in Object-Oriented Programming

asked 1xeasyOOPTechnical2019

Ans. Inheritance is an object-oriented programming feature where one class derives from another class and reuses or extends its fields and methods. The derived class, often called a subclass, can add new behaviour or override existing behaviour, while the base class defines shared functionality. It supports code reuse and represents “is a” relationships.

Q. Explain Polymorphism in Object-Oriented Programming

asked 1xeasyOOPTechnical2019

Ans. Polymorphism is the ability to treat different object types through the same interface while each type provides its own behaviour. For example, different shapes can all have an area method, but each calculates it differently. The key benefit is writing flexible code that depends on common behaviour rather than specific concrete classes.

Q. Can an abstract class contain a non-abstract method?

asked 1xeasyOOPManagerial2021

Ans. Yes, an abstract class can contain a non-abstract method. An abstract class may provide shared implemented behaviour as well as abstract methods that subclasses must implement. This is useful when several related classes need common code, but the base class should not be instantiated directly.

Q. Explain Encapsulation in Object-Oriented Programming

asked 1xeasyOOPTechnical2019

Ans. Encapsulation is the practice of keeping an object’s data and the methods that operate on it together, while hiding internal details from outside code. The key point is controlled access: fields are usually private, and other code interacts through public methods, which helps protect invariants and reduce unintended dependencies.

Q. How would you handle a challenging workplace situation and why?

asked 1xunknownSituational judgmentManagerial2020

Ans. Choose a real situation with tension, pressure, or disagreement, but not one that makes you look careless. Emphasise how you stayed calm, understood the issue, communicated clearly, involved the right people, and took ownership. Interviewers listen for judgement, resilience, teamwork, and a positive result or lesson learned.

Showing 60 of 85 questions. Ranked by how often the same question came back across interviews.

Practise an UHG-style interview

A spoken interview built from these questions, scored when you finish; the feedback is yours.

Start practising

When you are ready, record The One: a single interview hiring teams watch, so you stop repeating first rounds.

Common questions

What questions does UHG ask?

Candidate interviews most often cover DSA (44%) and CS fundamentals (39%).

How many rounds does UHG interview have?

Candidate interviews show an average of 3.3 rounds per experience, with a typical sequence of Online test → Technical → HR. Individual interview paths can vary.

Is the UHG interview hard?

Among questions with a recorded difficulty, the mix is easy 52%, medium 40%, hard 8%.