
Real Interview Questions for the Software Engineer at Samsung Electronics
NewInterview Q&A
Q&A-1Why do you want to work at Samsung?
Reported in Samsung Electronics Software Engineer interview experience (October 2025)
The 90-second answer
"I want to build software where the hardware constraints are real and the scale is unavoidable. At Samsung that means a Galaxy phone, a foldable, a watch and a TV running related code, with the same bug report behaving differently on an Exynos device and a Snapdragon device. That is the kind of problem I have been trying to get closer to."
Then I would name one area, not the whole company. For a platform role I would pick One UI and Galaxy AI on device. The interesting part is fitting on-device inference, battery budget and thermal limits into a phone that also has to run the camera pipeline and background sync. For a backend or services role I would pick SmartThings or Knox, where the hard part is identity, permissions and update safety across millions of devices that cannot be rebooted on demand.
I would also name what I bring that matches that work. In my last role I worked on an Android app with a 40 MB APK budget, a cold start target under 800 ms on mid-range hardware, and a crash-free rate we tracked per device model instead of as one average. That taught me to profile before I optimise and to ask which device class a change hurts first. I want the next step to be closer to the platform layer, where those decisions are made once and shipped everywhere.
Why Samsung specifically, in concrete terms
| What Samsung has | The engineering problem it creates | What I want to learn there |
|---|---|---|
| Vertical stack from Exynos and memory to One UI, Knox and SmartThings | A software fix can depend on a driver, a firmware version or a server rollout | How platform teams coordinate across that stack without blocking each other |
| Galaxy A, S, Z Fold and Z Flip on the same release train | Fragmentation in screen size, chipset, RAM and regional builds | How feature flags and staged rollouts are tested per device family |
| Galaxy AI features that run on device and in the cloud | Latency, privacy and cost trade-offs per request | How to decide what stays on device and how to degrade gracefully |
What breaks, and how I would catch it
A staged rollout that passes on Galaxy S and fails on Galaxy A is the failure I would expect first. The cause is usually not the feature code. It is a lower RAM ceiling, a slower CPU or a different thermal profile exposing a leak or a jank path that flagship testing missed. Detection is per model crash-free rate and per model cold start p95, not a global average. If Galaxy A cold start p95 moves from 750 ms to 1,400 ms in the 5 percent canary while Galaxy S stays flat, I would halt the rollout, keep the flag off for that family and bisect the change that added work on the main thread.
A bad firmware dependency is the second one. Suppose a camera or modem driver update changes timing, and an app update that assumed the old timing starts dropping frames or failing to connect. The app and firmware ship on different schedules, so the bug only appears on devices that took both updates. I would check the matrix in telemetry by firmware version as well as app version. If failures cluster on one firmware build, the fix is a version gate in the app, a fallback path and a joint test with the firmware team before the next staged rollout. Without that split, the team argues about whether the app or the driver is at fault and ships a fix for the wrong layer.
A third failure is a server change that assumes a new client. SmartThings or Knox code often has to support devices that will not update for months. If a backend change drops support for an old API field, older devices break silently. I would keep the old field accepted and ignored, log its use by client version, and only remove it after usage falls below a threshold we agree in advance. That is slower, and it prevents a support spike from devices the user cannot update.
What I would not say
I would not lead with brand prestige, job security or salary. Interviewers hear that from every candidate and it tells them nothing about fit. I would also avoid claiming I have always dreamed of Samsung since childhood. A specific, recent reason lands better: a project I shipped, a device I profiled, a problem I read about in a Samsung engineering post and want to work on properly.
If they push on motivation for the role itself, I would close with a near-term goal. "In the first six months I want to own a small, measurable piece, such as reducing cold start time for one One UI surface on Galaxy A devices, and learn how the release process handles a regression found after the staged rollout starts." That shows I understand the scale and I am not expecting a toy project on day one.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-2How would you find the Lowest Common Ancestor in a tree?
Reported in Samsung Electronics Software Engineer interview experience (October 2025)
The 90-second answer
For a binary tree, the lowest common ancestor of p and q is the deepest node whose subtrees contain one target each, or the node itself if it equals a target. I would start with the recursive version, state its assumptions, then handle the case where a target is missing.
Assumptions I would say out loud: the tree is binary, nodes are compared by identity or value consistently, and both targets are present. Without that last assumption, the simple recursion can return a wrong answer, as shown below.
# Python 3.12
from __future__ import annotations
class Node:
def __init__(self, val: int):
self.val = val
self.left: Node | None = None
self.right: Node | None = None
def lca(root: Node | None, p: Node, q: Node) -> Node | None:
if root is None or root is p or root is q:
return root
left = lca(root.left, p, q)
right = lca(root.right, p, q)
if left and right:
return root
return left or rightThe logic follows directly from the definition. If the current node is p or q, it is the answer for this subtree. Otherwise I ask each child for an answer. Two non-null answers mean the targets split across the children, so the current node is their meeting point. One answer means both targets are in that side. No answer means neither target is below here.
Worked trace
Tree: 3 has children 5 and 1; 5 has children 6 and 2; 2 has children 7 and 4. Find lca(7, 4).
| Call | Left result | Right result | Returns |
|---|---|---|---|
lca(7, 7, 4) | - | - | 7 |
lca(4, 7, 4) | - | - | 4 |
lca(2, 7, 4) | 7 | 4 | 2 |
lca(5, 7, 4) | 6 subtree: None | 2 | 2 |
lca(3, 7, 4) | 2 | 1 subtree: None | 2 |
Time is O(n) in the worst case, because the recursion explores both children at every node and does not prune a subtree until it has searched it. Stack depth is O(h), where h is the height. For a balanced tree h is O(log n), but time is still O(n) in the worst case, not O(h). For a skewed tree, h is O(n), so stack depth degrades to O(n) and can overflow the call stack.
When the tree is not a plain binary tree
| Tree type | Approach | Cost |
|---|---|---|
| Binary tree, unordered | Recursion above | O(n) time, O(h) stack |
| Binary search tree | Walk down using ordering: if both targets are smaller, go left; if both larger, go right; otherwise split here | O(h) time, O(1) extra space iterative |
| N-ary tree | Return the child results; if two or more children return non-null, current node is the answer | O(n) time, O(h) stack |
| General graph with cycles | Mark ancestors of p with a visited set, then walk from q until a marked node appears | O(n) time and space |
For a BST the iterative version is worth writing because it avoids recursion entirely:
def lca_bst(root: Node, p: Node, q: Node) -> Node:
node = root
while node:
if p.val < node.val and q.val < node.val:
node = node.left
elif p.val > node.val and q.val > node.val:
node = node.right
else:
return node
return node # unreachable if both targets are presentFailure modes and follow-ups
Missing target: if q is absent, lca(3, 7, 99) on the tree above returns 7. Tracing it: node 2 gets 7 from its left child and None from node 4, so it returns 7; node 5 and then node 3 propagate that 7 upward. That result looks like a valid ancestor, but 99 is not in the tree, so there is no lowest common ancestor. I fix that by first checking both nodes exist, either with a contains search or by counting how many targets the recursion found. In production code I would do the explicit check and return None or raise, rather than silently returning the one target that was found.
Null root and p is q: a null root returns None immediately. If p is q, the answer is that node, and the recursion handles it because the first check matches.
Deep skewed tree: recursion depth equals height. At 100,000 nodes in a chain, Python hits its recursion limit and C++ can overflow the call stack. The fix is an explicit stack for a post-order traversal, or the BST walk above when ordering is available.
Duplicate values: comparing by val instead of identity breaks when two nodes hold the same value. I would clarify whether nodes are unique by value or by identity and use is for identity, as in the code above.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-3What is the time complexity of sorting algorithms?
Reported in Samsung Electronics Software Engineer interview experience (October 2025)
The 90-second answer
There is no single complexity. Comparison sorts have a floor of Ω(n log n), and the algorithms that beat it do so by not comparing elements. I would split the answer that way in an interview.
For a comparison sort, each comparison has two outcomes, so a decision tree with h leaves needs height at least log2(h). Sorting n distinct items has n! leaves, so any comparison sort needs at least log2(n!) comparisons, which is n log n minus O(n) by Stirling's approximation. That bound is tight. Merge sort and heap sort hit Θ(n log n) in the worst case. Quick sort hits it on average but can degrade to Θ(n²).
| Algorithm | Best | Average | Worst | Extra space | Stable | In place |
|---|---|---|---|---|---|---|
| Insertion sort | Ω(n) | Θ(n²) | Θ(n²) | O(1) | Yes | Yes |
| Selection sort | Θ(n²) | Θ(n²) | Θ(n²) | O(1) | No | Yes |
| Bubble sort | Ω(n) | Θ(n²) | Θ(n²) | O(1) | Yes | Yes |
| Merge sort | Θ(n log n) | Θ(n log n) | Θ(n log n) | O(n) | Yes | No |
| Quick sort | Ω(n log n) | Θ(n log n) | Θ(n²) | O(log n) stack | No | Yes |
| Heap sort | Θ(n log n) | Θ(n log n) | Θ(n log n) | O(1) | No | Yes |
| Counting sort | Θ(n + k) | Θ(n + k) | Θ(n + k) | O(k) | Yes | No |
| Radix sort (base 256) | Θ(n) | Θ(n) | Θ(n) | O(n) | Yes | No |
Here n is the number of elements and k is the range of keys for counting sort. Radix sort is linear in n for fixed-width keys, for example 32-bit integers processed in four passes of 8 bits.
Worked figures
For n = 1,000,000, n log2 n is about 20 million. A comparison sort needs at least roughly that many comparisons in the worst case, and merge sort does about n log2 n minus n plus 1 comparisons on a good split. Insertion sort on reversed input does n(n-1)/2 comparisons, about 5 × 10¹¹ for the same n. That gap is why the quadratic sorts only appear for tiny or nearly sorted inputs. Insertion sort is still used inside many libraries for runs under about 16 to 32 elements, where its low constant and branch behaviour beat a recursive split.
Code: counting sort, the non-comparison case
def counting_sort(a: list[int]) -> list[int]:
if not a:
return []
k = max(a)
count = [0] * (k + 1)
for x in a:
count[x] += 1
out = []
for value, freq in enumerate(count):
out.extend([value] * freq)
return out
assert counting_sort([4, 2, 2, 8, 3]) == [2, 2, 3, 4, 8]This runs in Θ(n + k) time and O(k) extra space. It fails as a choice when k is large. Sorting one million values drawn from a range of 10⁹ would allocate a billion counters, so the memory cost dominates and a comparison sort wins despite the worse asymptotic class. The same warning applies to radix sort when keys are strings of unbounded length. Its cost is Θ(n × L) for key length L, so it is linear only when L is bounded.
Failure modes interviewers probe
Quick sort's Θ(n²) worst case is not theoretical. A naive first-element pivot on already sorted input, which is common in log files and sensor dumps, produces n recursive levels and about n²/2 comparisons. Production implementations guard against it. Median-of-three pivot selection removes the sorted-input trap, and introsort, used by C++ std::sort, switches to heap sort once recursion depth exceeds 2 × floor(log2 n). That caps the worst case at Θ(n log n) while keeping quick sort's cache behaviour on typical data.
Merge sort trades memory for predictability. It needs O(n) auxiliary space, which matters on memory constrained embedded targets where an in-place heap sort or quick sort may be the only option. Python's Timsort and Java's Arrays.sort for objects are adaptive merge sorts. They detect natural runs, so nearly sorted data sorts in close to Ω(n), while the worst case stays Θ(n log n).
If I had to pick one default for general purpose code, I would say introsort or Timsort depending on the language, because both keep the Θ(n log n) guarantee and handle the sorted and reversed cases that break naive quick sort. I would reach for counting or radix sort only when the key range or width is known and small, such as sorting 16-bit sensor readings or 32-bit IDs.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-4What are different ways to swap two numbers?
Reported in Samsung Electronics Software Engineer interview experience (May 2026)
The 90-second answer
In C++ I would default to std::swap(a, b) or a temporary variable. Both are clear, work for any type, and a modern compiler turns the temporary into a register move with no extra memory traffic. I would mention the arithmetic and XOR tricks only to explain when they break, because interviewers at Samsung usually follow up on overflow and aliasing.
// C++17, checked against libstdc++ / libc++
#include <utility>
void swap_temp(int& a, int& b) {
int tmp = a;
a = b;
b = tmp;
}
void swap_std(int& a, int& b) {
std::swap(a, b); // <utility>, since C++11
}std::swap matters beyond int. Since C++11 it is implemented with move construction and move assignment, so it works for std::string, std::vector, and types that cannot be copied cheaply. A hand-written temporary with auto tmp = a; gets the same benefit if you use auto instead of naming the type.
| Method | Code for a, b | Cost | Main failure mode |
|---|---|---|---|
| Temporary | tmp=a; a=b; b=tmp; | 3 moves, 1 extra slot | None for plain types; compiler usually elides the slot |
std::swap | std::swap(a,b); | 3 moves | None; move-aware since C++11 |
| Arithmetic | a=a+b; b=a-b; a=a-b; | 3 adds/subs, no slot | Signed overflow is undefined behaviour in C++ |
| XOR | a^=b; b^=a; a^=b; | 3 XORs, no slot | Breaks when a and b are the same object |
Worked trace
Take a = 5, b = 3:
| Step | Temporary | Arithmetic | XOR |
|---|---|---|---|
| Start | a=5, b=3 | a=5, b=3 | a=5, b=3 |
| 1 | tmp=5 | a=8 | a=6 (5 xor 3) |
| 2 | a=3 | b=5 (8-3) | b=3 (6 xor 3) |
| 3 | b=5 | a=3 (8-5) | a=5 (6 xor 3) |
| End | a=3, b=5 | a=3, b=5 | a=3, b=5 |
All three end in the same state for distinct variables. The differences show up at the edges.
Failure modes I would name in the loop
Arithmetic swap fails on overflow. With 32-bit int, a = 2'000'000'000 and b = 1'500'000'000 make a + b exceed INT_MAX (2'147'483'647). Signed overflow in C++ is undefined behaviour, so the compiler is allowed to assume it never happens and optimise around that assumption. Unsigned arithmetic wraps modulo 2^32 and would survive, but that is a special case, not a general swap.
XOR swap fails on aliasing. If a and b refer to the same variable, for example swap(x, x) or two pointers to one object, the first step a ^= b computes x ^ x = 0 and destroys the value. The temporary version handles swap(x, x) correctly. std::swap also handles it, because the moves read the old value before overwriting.
Both tricks also fail for non-integer types. You cannot XOR a std::string or add two structs, while std::swap works for any move-assignable type. In embedded code at Samsung, where the same helper might swap sensor readings, handles, or buffers, that generality is the practical reason to prefer it.
If an interviewer pushes on why anyone uses XOR at all: it was a historical trick to save a register on very small machines. On current ARM or x86 targets the compiler generates the same register moves from the temporary version, so the trick buys nothing and costs readability and correctness. I would say that plainly and keep the temporary or std::swap as the answer.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-5How would you solve the Meeting Rooms I and II problems?
Reported in Samsung Electronics Software Engineer interview experience (May 2026)
The 90-second answer
Meeting Rooms I asks whether one room can host every meeting. Meeting Rooms II asks how many rooms you need if meetings overlap. Both reduce to sorting by start time and scanning once.
For I, sort by start and check each meeting against the previous one. If start < prev_end, they overlap and the answer is false. For II, keep the end times of meetings currently in progress in a min-heap. For each meeting in start order, pop the earliest ending meeting if it has finished, then push the current meeting. The heap size is the number of rooms in use, and its maximum is the answer.
from heapq import heapify, heappush, heappop
def can_attend(intervals): # Meeting Rooms I
intervals.sort(key=lambda x: x[0])
for i in range(1, len(intervals)):
if intervals[i][0] < intervals[i - 1][1]:
return False
return True
def min_rooms(intervals): # Meeting Rooms II
intervals.sort(key=lambda x: x[0])
ends = [] # min-heap of end times for active meetings
peak = 0
for start, end in intervals:
if ends and ends[0] <= start:
heappop(ends)
heappush(ends, end)
peak = max(peak, len(ends))
return peakThe condition ends[0] <= start matters. A meeting ending at 10 and another starting at 10 can share a room, so equality is not an overlap. Using < there would overcount rooms.
Worked trace for II
Input: [[0,30],[5,10],[15,20]], sorted by start.
| Meeting | Heap before | Action | Heap after | Rooms in use |
|---|---|---|---|---|
| [0,30] | [] | push 30 | [30] | 1 |
| [5,10] | [30] | 30 > 5, push 10 | [10,30] | 2 |
| [15,20] | [10,30] | pop 10 (10 <= 15), push 20 | [20,30] | 2 |
Peak is 2, so two rooms suffice. The heap always holds the earliest finishing active meeting at the top, which is exactly the room that frees up first.
How the two differ
| I: can attend all | II: minimum rooms | |
|---|---|---|
| Question | Is the maximum overlap 1? | What is the maximum overlap? |
| Data structure | Previous end time only | Min-heap of active end times |
| Time | O(n log n), dominated by sort | O(n log n), sort plus heap ops |
| Space | O(1) extra beyond sort | O(n) for the heap |
II generalises I. If you run the II logic and the peak is 1, I is true. In an interview I would implement them separately anyway, because I needs no heap and the code is shorter to defend.
Edge cases and follow-ups
Empty input: I returns true, II returns 0. Unsorted input is the normal case, so sorting is not optional. Duplicate start times are fine. The sort is stable in Python, but correctness does not depend on tie-breaking because any order among equal starts still detects overlap.
A common follow-up is to return the actual room assignment, not just the count. That needs a second heap of free room ids alongside the end-time heap, so you can pop a freed room and reuse its id. Another follow-up is streaming meetings that arrive out of order. Then the offline sort breaks, and you need an interval tree or a balanced BST keyed by start time, with O(log n) insert and overlap checks. For the constraints usually given, n up to 10^4 or 10^5, the sort-based version is fast enough and far easier to get right under time pressure.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-6Given a 2D grid of 1s and 0s, how would you count the number of distinct islands?
Reported in Samsung Software Engineer Interview Questions | Screna AI
The 90-second answer
Assume 4-directional connectivity (up, down, left, right), as stated, and that I may mutate the grid. Scan every cell once. When I find a 1 I have not visited, that is a new island, so I increment the count and flood-fill all cells reachable from it, marking them visited so they are not counted again. Each cell is processed once, giving O(R*C) time and O(R*C) worst-case space for the stack.
def count_islands(grid):
if not grid or not grid[0]:
return 0
rows, cols = len(grid), len(grid[0])
count = 0
for r in range(rows):
for c in range(cols):
if grid[r][c] != 1:
continue
count += 1
stack = [(r, c)]
grid[r][c] = 0 # mark visited in place
while stack:
x, y = stack.pop()
for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
nx, ny = x + dx, y + dy
if 0 <= nx < rows and 0 <= ny < cols and grid[nx][ny] == 1:
grid[nx][ny] = 0
stack.append((nx, ny))
return countWorked trace
For this grid, the scan finds a new island at (0,0), floods its 3 cells, then finds another at (2,3). The isolated 1 at (2,0) is a third island.
| Step | Cell found | Action | Count after |
|---|---|---|---|
| --- | --- | --- | --- |
| 1 | (0,0) | Flood (0,0), (0,1), (1,1) | 1 |
| 2 | (2,0) | Flood (2,0) alone | 2 |
| 3 | (2,3) | Flood (2,3), (2,2) | 3 |
Result: 3. The diagonal pair (0,1) and (2,2) never merges anything, because diagonal moves are excluded.
Choosing the traversal
| Approach | Time | Extra space | When I would pick it |
|---|---|---|---|
| Iterative DFS (above) | O(R*C) | O(K) stack, K = largest island | Default. Simple, cache-friendly scan order. |
| BFS with a queue | O(R*C) | O(K) queue, usually larger constant | When I need level-by-level distance, which this question does not. |
| Union-Find over land cells | O(R*C * alpha(R*C)) | O(L) for L land cells | Streaming rows, or the grid arrives in tiles and I must merge components across tile borders. |
| Recursive DFS | O(R*C) | Call stack, one frame per cell in the worst case | Never for production grids. A 1 x 5000 strip of 1s exceeds Python's default recursion limit of 1000 and raises RecursionError. |
Failure modes I would name in the loop
Mutating the input is the first trap. If the caller reuses the grid, in-place marking corrupts it. The fix is a separate bytearray visited bitmap, which costs R*C bytes and keeps the input intact. On memory-constrained embedded targets, which Samsung hardware teams care about, that trade-off is worth stating explicitly.
The second trap is scale. A 10,000 x 10,000 grid holds 100 million cells. The scan itself is fine, but a snake-shaped island can push close to 100 million entries onto the stack in the worst case. I would cap that risk by processing in row bands or switching to Union-Find if the grid does not fit comfortably in memory.
The third trap is the connectivity definition. If the interviewer meant 8-directional, the same code works by adding the four diagonal offsets, and the answer for the trace grid drops from 3 to 2. I would confirm the definition before coding, because it changes the result, not just the implementation.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-7How would you find the maximum area of an island, optimized for embedded systems constraints?
Reported in Samsung Software Engineer Interview Questions | Screna AI
The 90-second answer
Assume a binary grid, 1 is land, 0 is water, 4-directional adjacency, and the grid may not fit in RAM twice. I would not use recursive DFS. On an embedded target recursion depth equals island size, so a 10,000-cell island can overflow a 4 KB task stack even though the algorithm is correct on a laptop.
I would use an iterative scan with in-place marking when the grid is writable, and a two-pass union-find labelling when the grid arrives row by row and cannot be mutated. Both are O(R*C) time. The difference is peak memory and worst-case stack.
For the common case where I own the grid, iterative DFS with an explicit stack and marking visited in the grid itself needs no visited array:
#include <stdint.h>
#include <stddef.h>
/* grid: row-major, values 0 or 1 on entry, 2 = visited land on exit */
uint32_t max_island_area(uint8_t *grid, size_t rows, size_t cols,
uint32_t *stack, size_t stack_cap)
{
uint32_t best = 0;
const int dr[4] = {-1, 1, 0, 0};
const int dc[4] = {0, 0, -1, 1};
for (size_t r = 0; r < rows; r++) {
for (size_t c = 0; c < cols; c++) {
size_t idx = r * cols + c;
if (grid[idx] != 1) continue;
uint32_t area = 0;
size_t sp = 0;
stack[sp++] = (uint32_t)idx;
grid[idx] = 2;
while (sp > 0) {
uint32_t cur = stack[--sp];
area++;
size_t cr = cur / cols, cc = cur % cols;
for (int k = 0; k < 4; k++) {
int nr = (int)cr + dr[k], nc = (int)cc + dc[k];
if (nr < 0 || nc < 0 || (size_t)nr >= rows || (size_t)nc >= cols) continue;
size_t nidx = (size_t)nr * cols + (size_t)nc;
if (grid[nidx] != 1) continue;
if (sp >= stack_cap) return UINT32_MAX; /* caller falls back */
grid[nidx] = 2;
stack[sp++] = (uint32_t)nidx;
}
}
if (area > best) best = area;
}
}
return best;
}The stack_cap check matters. If the caller cannot guarantee a stack as large as the largest island, that return is the signal to switch strategies, not a silent overflow. A fixed stack of, say, 1,024 entries uses 4 KB. A 256 by 256 grid has 65,536 cells, so worst-case DFS stack is 65,536 entries, 256 KB, which will not fit.
Worked trace
Grid 4 by 5, 1 is land:
| r\c | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| 0 | 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 | 1 |
| 2 | 0 | 0 | 0 | 1 | 0 |
| 3 | 1 | 1 | 0 | 0 | 0 |
Scan order finds the top-left island first. Stack pushes (0,0), marks it 2, pushes (0,1) and (1,0). It pops (1,0), then (0,1), area 3, best 3. Next unvisited land is (0,4), which connects to (1,4), (1,3), (2,3), area 4, best 4. Last island at (3,0) has area 2. Answer 4. Marking on push, not on pop, is what prevents the same cell entering the stack four times.
When the grid is streamed or read-only
If rows arrive from a sensor or file and I cannot store the whole grid, DFS is the wrong tool. I use two-pass labelling with union-find over the current row only. Each land cell gets a provisional label. It inherits the label above or to the left, and if both exist and differ I union them and record the equivalence. After the pass, I count cells per root label. Memory is O(cols) for labels plus O(number of distinct islands) for counts, not O(R*C). For 256 columns that is about 512 bytes of labels, versus 64 KB for a full visited byte array or 8 KB for a bitset.
| Approach | Extra memory | Worst-case stack | Mutates grid | Streaming input |
|---|---|---|---|---|
| Recursive DFS | O(island) call stack | O(island), unbounded | No, needs visited array | No |
| Iterative DFS, in-place | O(island) explicit stack | Bounded by stack_cap, checked | Yes | No |
| Iterative BFS with queue | O(island) queue | Bounded by queue cap | Yes, if marking in place | No |
| Two-pass union-find | O(cols + islands) | O(1) | No | Yes |
Failure modes I would name in the loop
Stack overflow from recursion, or from an unchecked explicit stack when one island fills the grid. Integer overflow if area is stored in uint16_t: a 256 by 256 all-land grid needs 65,536, which wraps to 0. Use uint32_t for area and for indices when R*C exceeds 65,535. Diagonal adjacency is a spec question, not a detail. LeetCode 695 uses 4-directional, and I would state that assumption before coding, because 8-directional changes every neighbour check. Finally, in-place marking destroys the input. If the caller needs the original map, I copy it or use the union-find path, and I say so up front rather than corrupting a buffer the caller still owns.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-8Can you walk through your resume and past projects?
Reported in Samsung Electronics Software Engineer interview experience (June 2026)
The 90-second answer
I will cover two projects, because they show different sides of my work. The first is a backend service I owned end to end. The second is a device-side feature where I worked under tight memory and battery limits. I will keep each one to problem, my specific contribution, and a measured result.
Project one: an order-tracking service in Python and PostgreSQL, about 40,000 requests a day at peak. I designed the ingestion API, the polling worker, and the read model. The hard problem was duplicate carrier webhooks. Two webhooks for the same shipment could arrive 200 ms apart and both pass a naive existence check. I added a unique constraint on (carrier, carrier_event_id) and made the handler idempotent, so the second delivery returned the stored result instead of inserting a second row. Duplicate rows went from roughly 900 a week to zero in the first month after the change. p95 read latency dropped from 320 ms to 110 ms after I replaced an offset-based list query with a keyset cursor on (updated_at, id) and added a covering index.
Project two: a background sync feature for an Android app, written in Kotlin with WorkManager and Room. The constraint was battery. The first version synced every 15 minutes and drained about 6% per hour on a test device in airplane-mode-off idle conditions. I moved it to constraint-based scheduling, batched writes in a single transaction, and added exponential backoff with jitter for failed uploads. Drain fell to about 1.1% per hour in the same test, and sync success rose from 91% to 99.2% over a four-week rollout to 12,000 users. Crash-free sessions stayed above 99.6%.
What I would redo: in project one I underestimated webhook volume during sale events and had to add a queue later. If I started again I would put the queue in from day one.
| Project | My scope | Result I can defend |
|---|---|---|
| Order tracking, Python/PostgreSQL | API, worker, schema, indexes | 0 duplicate rows/week, p95 320 ms to 110 ms |
| Android sync, Kotlin/Room | Scheduling, storage, retry logic | Battery drain 6% to 1.1% per hour, sync success 91% to 99.2% |
How I structure it when the interviewer digs in
I keep a one-page map in my head so I do not ramble:
For the idempotency fix, the core of the handler looked like this:
# Python 3.12, checked against PostgreSQL 16
def handle_webhook(event):
try:
with db.transaction():
db.execute(
"INSERT INTO carrier_events (carrier, carrier_event_id, payload) VALUES (%s, %s, %s)",
(event.carrier, event.id, event.payload),
)
except UniqueViolation:
return {"status": "duplicate", "event_id": event.id}
enqueue_status_update(event)
return {"status": "accepted", "event_id": event.id}The unique constraint does the work. The application check alone would race.
If you ask about testing
For the service I wrote contract tests for the webhook payloads from each carrier, plus a load test at 3 times peak traffic. That test caught a connection pool limit of 20 that saturated at about 25 requests per second in the staging setup, which I raised and retested before release. For the Android feature I tested on three physical devices, including one with 2 GB of RAM, and used a low-memory kill test to confirm Room transactions rolled back cleanly.
Why Samsung fits
I want work where software meets hardware limits and ships at scale. The Android project taught me to measure battery and memory on real devices instead of trusting the emulator. That is the kind of constraint I want to keep working under, with a release train and a hardware lab close by.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-9How would you remove duplicates from a linked list in place?
Reported in Samsung Electronics Software Engineer interview experience (June 2026)
The 90-second answer
I would first ask whether the list is sorted, because that decides the space cost. If it is sorted, duplicates are adjacent and I can remove them in one pass with O(1) extra space. If it is unsorted, I need either a hash set for O(n) time and O(n) space, or a nested scan for O(n^2) time and O(1) space. In place means I reuse the existing nodes, relink pointers, and free the removed nodes. I never build a second list.
Assume a singly linked list, head may be null, and duplicate means equal data values. I keep the first occurrence and delete later ones.
Sorted case: O(n) time, O(1) space
// C17. Assumes ascending order. Frees removed nodes.
struct Node { int data; struct Node *next; };
void dedupe_sorted(struct Node *head) {
for (struct Node *cur = head; cur && cur->next; ) {
if (cur->next->data == cur->data) {
struct Node *dup = cur->next;
cur->next = dup->next;
free(dup);
} else {
cur = cur->next;
}
}
}Trace for 1 -> 2 -> 2 -> 3 -> 3 -> 3 -> 4:
| Step | cur | cur->next | Action | List after step |
|---|---|---|---|---|
| 1 | 1 | 2 | advance | 1 -> 2 -> 2 -> 3 -> 3 -> 3 -> 4 |
| 2 | 2 | 2 | unlink and free second 2 | 1 -> 2 -> 3 -> 3 -> 3 -> 4 |
| 3 | 2 | 3 | advance | 1 -> 2 -> 3 -> 3 -> 3 -> 4 |
| 4 | 3 | 3 | unlink and free one 3 | 1 -> 2 -> 3 -> 3 -> 4 |
| 5 | 3 | 3 | unlink and free one 3 | 1 -> 2 -> 3 -> 4 |
| 6 | 3 | 4 | advance, then end | 1 -> 2 -> 3 -> 4 |
Note the loop does not advance after a deletion. Advancing there would skip checking the new cur->next against cur and miss a run of three or more duplicates.
Unsorted case
With a hash set, I walk once, keep a set of values seen, and unlink any node whose value is already present. That is O(n) average time and O(k) space for k distinct values. In C I would use a hash table or, in C++, unordered_set<int>. The trade-off is memory and hash worst case behaviour. For a list of 10 million nodes with 1 million distinct values, the set holds about 1 million entries, which can exceed the list node overhead on a memory constrained device.
Without extra storage, I compare each node against every later node:
void dedupe_unsorted_o1(struct Node *head) {
for (struct Node *cur = head; cur; cur = cur->next) {
for (struct Node *prev = cur, *scan = cur->next; scan; ) {
if (scan->data == cur->data) {
struct Node *dup = scan;
prev->next = scan->next;
scan = scan->next;
free(dup);
} else {
prev = scan;
scan = scan->next;
}
}
}
}That is O(n^2) time. For n = 10,000 that is roughly 50 million comparisons, which is fine for a one off cleanup and unacceptable in a hot path.
| Variant | Time | Extra space | When I pick it |
|---|---|---|---|
| Sorted, single pass | O(n) | O(1) | Input guaranteed sorted, or I can sort first |
| Unsorted, hash set | O(n) average | O(k) | Large list, memory available, latency matters |
| Unsorted, nested scan | O(n^2) | O(1) | Small list, no allocation allowed, embedded context |
| Sort then dedupe | O(n log n) | O(1) to O(n) depending on sort | Order of remaining nodes does not matter |
Failure modes I check
Freeing matters. Unlinking without free leaks every duplicate node, and on a long running service that leak grows with traffic. I also test an empty list, a single node, all nodes equal, and duplicates at the head. The head case is safe here because I never remove head itself, only nodes after a kept node. If the requirement were to keep the last occurrence instead of the first, the hash version changes to overwrite the stored node pointer, and the sorted version still keeps the first of each run, so I would state that choice up front.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-10Design a platform for uploading syllabus videos?
Reported in Samsung Electronics Software Engineer interview experience (June 2026)
The 90-second answer
I would split this into three planes: upload, processing, and delivery. A teacher uploads a large file once, the platform transcodes it into playable renditions in the background, and students stream the smallest rendition that fits their connection. The upload path never waits for transcoding, and playback never reads the original file.
Assume 50,000 teachers, 2 million students, 200,000 videos a year, average 45 minutes at 720p. That is roughly 1.2 GB per original, about 240 TB of originals a year before renditions. I would state that up front because it drives storage cost and the decision to use object storage with a CDN, not a file server.
Upload: resumable, chunked, and idempotent.
A 1.2 GB file over a teacher's home connection will fail mid-upload. A single POST /videos with the whole body is not credible. I would use multipart upload: the client asks for an upload session, uploads 5 MB parts directly to object storage with presigned URLs, then calls complete.
| Step | Call | What the server checks |
|---|---|---|
| Create session | POST /uploads with title, subject, class, duration estimate | Teacher owns the course, quota not exceeded |
| Upload part | PUT to presigned URL, part 1..N | Part size, checksum per part |
| Complete | POST /uploads/{id}/complete with part list | All parts present, total size matches |
| Publish | POST /videos/{id}/publish | Transcoding finished, at least one rendition ready |
The client generates an Idempotency-Key per session. If the browser retries the complete call, the server returns the same video ID instead of creating a duplicate. Each part carries a checksum, and the server verifies the assembled object's checksum before marking the video PROCESSING. Without that, a corrupted part produces a video that fails at minute 31 and nobody knows which upload caused it.
# Checked against boto3 1.34, S3 multipart API
import boto3
s3 = boto3.client("s3")
resp = s3.create_multipart_upload(Bucket="syllabus-videos", Key="raw/2026/v_1842.mp4")
for i in range(1, 241): # 240 x 5 MB parts for ~1.2 GB
url = s3.generate_presigned_url(
"upload_part",
Params={"Bucket": "syllabus-videos", "Key": "raw/2026/v_1842.mp4",
"UploadId": resp["UploadId"], "PartNumber": i},
ExpiresIn=3600,
)
yield url # client PUTs the part directly to S3, bypassing the API tierProcessing: async transcode with a state machine.
Completing the upload enqueues a job and returns 202. Workers pull from the queue, run FFmpeg to produce 360p, 720p, and 1080p renditions plus a thumbnail and a caption track if the teacher supplied one, then write renditions back to object storage under the same video ID. The video row moves PROCESSING -> READY only when the manifest exists. If a worker dies mid-job, the queue's visibility timeout expires and another worker picks it up. A job that fails three times goes to a dead-letter queue and the video is marked FAILED with a reason the teacher can act on, such as unsupported codec.
I would not transcode synchronously in the request. A 45 minute 1080p source takes several minutes of CPU per rendition on a single worker. Holding an HTTP request open that long guarantees timeouts and ties up API instances for no reason.
Delivery and the syllabus structure.
Videos are not a flat list. They sit under subject, class, chapter, and topic, and a teacher can reorder them without re-uploading. So the metadata DB holds courses, chapters, and videos with a position column, and the player reads a manifest that lists renditions by bitrate. The player picks 360p on a slow connection and steps up when bandwidth allows. Playback URLs are signed and short-lived, say 15 minutes, so a leaked link does not give permanent access to paid content.
For scale, the arithmetic that matters: 200,000 videos a year at three renditions averaging 400 MB each is about 240 TB of renditions plus 240 TB of originals. Object storage handles that without sharding. The bottleneck is not storage, it is transcode throughput. At 10 minutes of worker time per video, 200,000 videos need about 33,000 worker-hours a year, roughly 4 workers running continuously, or 40 workers for a few days after a bulk upload. That tells me to autoscale the worker pool on queue depth and to cap concurrent jobs per teacher so one bulk upload does not starve everyone else.
Failure modes I would name in the loop.
A teacher uploads a 4 GB file that exceeds the session limit. The create call rejects it with 413 and a max size, rather than letting the upload start and fail at part 700. A transcode worker produces a rendition with no audio track. The worker checks duration and audio stream presence before marking READY, because a silent lecture passes every file-size check and only a student notices. A CDN edge serves a stale manifest after a teacher replaces a video. The manifest URL includes a version, and publishing a replacement bumps the version, so old edges expire on their own instead of serving the old lecture indefinitely.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-11What are the differences between arrays and linked lists, and when would you use one over the other?
Reported in Samsung Electronics Software Engineer interview experience (December 2023)
The 90-second answer
An array stores elements in contiguous memory, so the address of element i is base + i * sizeof(element). That gives O(1) random access and lets hardware prefetch and cache lines work for you. A linked list stores each element in a node that also holds a pointer to the next node, so you reach element i only by walking i pointers. That gives O(1) insertion and deletion once you already hold the pointer, at the cost of O(n) access and scattered memory.
I pick based on the dominant operation. Random access, iteration over the whole set, binary search, or a DMA buffer goes in an array. Frequent insertion or deletion in the middle, with mostly sequential traversal and no need to index, can justify a list. In firmware work at Samsung scale, that second case is rarer than people expect, because dynamic allocation itself is often the problem.
| Property | Array | Singly linked list |
|---|---|---|
| Access by index | O(1), one address calculation | O(n), pointer chase from head |
| Insert at head | O(n) if shifting, or O(1) with a ring buffer | O(1) |
| Insert in middle | O(n) memmove | O(1) after O(n) search |
| Append | O(1) amortised if capacity remains, O(n) on resize | O(1) with tail pointer, O(n) without |
| Memory per element, 64-bit | 4 bytes for an int32_t | 16 bytes: 4 value, 4 padding, 8 pointer |
| Contiguity | Yes, required for DMA and memcpy | No |
| Failure mode | Resize copies everything, can fail under memory pressure | Fragmentation, cache misses, dangling pointer on free |
Where the numbers decide it
Take 1,000,000 int32_t values. An array is 4 MB in one block. A sequential scan touches 4 MB, about 65,536 cache lines of 64 bytes, each line delivering 16 values. A linked list is 16 MB before allocator overhead, and nodes allocated over time rarely sit in address order. The same scan can touch 1,000,000 cache lines if each node lands on its own line, which is why measured scans of lists often run 5 to 10 times slower despite identical element counts. That gap widens on a phone SoC where the list lives in DRAM and the array scan can stay in cache-friendly bursts.
Insertion shows the opposite trade. Inserting at position 500,000 in an array moves 500,000 elements, 2 MB with memmove, which is fast because it is sequential. In a list you first walk 500,000 nodes to find the spot, then do two pointer writes. If you already hold an iterator to that spot, the list wins. If you do not, the walk dominates.
// C, checked against a typical 64-bit Linux / Android toolchain
#include <stdint.h>
#include <stdlib.h>
typedef struct Node {
int32_t value;
struct Node *next; // 8 bytes on 64-bit, 4 bytes of padding after value
} Node;
int insert_after(Node *prev, int32_t value) {
Node *n = malloc(sizeof *n);
if (!n) return -1; // allocation failure is a real path in embedded code
n->value = value;
n->next = prev->next;
prev->next = n;
return 0;
}That malloc is the part interviewers probe. In a kernel driver or a fixed firmware image, I would usually avoid it entirely. A statically sized array, or a ring buffer for a queue, gives a known worst case, no fragmentation, and no failure at runtime. A list built from a preallocated pool of nodes keeps the pointer logic but removes the allocator from the hot path.
When I would still choose a list
An LRU cache, a free list of buffers, or a queue where producers and consumers only touch the ends. There the operations are head and tail work, traversal is rare, and the list avoids shifting a large array on every dequeue. Even there I would ask whether a ring buffer does the same job with contiguous storage. For a queue it usually does, and it also gives O(1) access by sequence number for debugging.
The failure modes I name in an interview: losing the head pointer loses the whole list, a cycle makes traversal loop forever, and freeing a node that another iterator still references creates a use after free that is hard to reproduce. Arrays fail differently. A fixed array overflows silently in C if you skip bounds checks, and a dynamic array that doubles can briefly need old plus new capacity, 12 MB for a 4 MB array growing to 8 MB, which can fail on a constrained device even though the final size would fit.
So my default is an array unless the workload is insertion heavy at known positions, traversal is sequential, and I can prove the memory overhead and cache cost do not break the latency budget.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-12Implement a basic sorting algorithm and walk through its time complexity?
Reported in Samsung Electronics Software Engineer interview experience (December 2023)
The 90-second answer
I would implement merge sort, state the assumptions, then walk the recurrence. It sorts n elements in O(n log n) time in the worst case, uses O(n) extra space, and is stable. That worst-case guarantee is why I pick it over quicksort for a first implementation, even though quicksort usually wins on constant factors and in-place memory.
Assumptions: a mutable sequence, a total order defined by <, and no requirement to sort in place. If the interviewer wants in-place, I say so and switch to quicksort or heapsort.
# Python 3.11, checked against CPython 3.11
def merge_sort(a):
if len(a) <= 1:
return a
mid = len(a) // 2
left = merge_sort(a[:mid])
right = merge_sort(a[mid:])
merged = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] <= right[j]: # <= keeps equal elements in original order
merged.append(left[i])
i += 1
else:
merged.append(right[j])
j += 1
merged.extend(left[i:])
merged.extend(right[j:])
return mergedWalking the complexity
At each level of recursion the merge step touches every element once, so one level costs O(n). Splitting in half gives log2(n) levels, because the size halves until it reaches 1. Total work is O(n log n). The recurrence is T(n) = 2T(n/2) + O(n), with T(1) = O(1), and that solves to O(n log n).
For a concrete size, n = 1,000,000 gives about 20 * 1,000,000 = 20,000,000 element moves across all levels, since log2(1,000,000) is just under 20. Best, average, and worst case are all O(n log n) here, because the split never depends on the input values. That is the point of the algorithm.
Worked trace for [5, 2, 4, 1, 3]:
| Step | Left half | Right half | Merged result |
|---|---|---|---|
split [5,2,4,1,3] | [5,2] | [4,1,3] | — |
sort [5,2] | [5] | [2] | [2,5] |
sort [4,1,3] | [4] | [1,3] | — |
sort [1,3] | [1] | [3] | [1,3] |
merge [4] and [1,3] | [4] | [1,3] | [1,3,4] |
| final merge | [2,5] | [1,3,4] | [1,2,3,4,5] |
Where it loses, and what I would say next
Merge sort allocates new lists at every level. On a memory-constrained embedded target, that O(n) allocation can fail where an in-place sort would not, and the slicing in the Python version above copies data repeatedly. A production C++ version would merge into a scratch buffer instead. Recursion depth is O(log n), so stack overflow is not a concern at realistic sizes, unlike a degenerate quicksort.
| Algorithm | Worst case | Extra space | Stable | In place |
|---|---|---|---|---|
| Insertion sort | O(n^2) | O(1) | Yes | Yes |
| Merge sort | O(n log n) | O(n) | Yes | No |
| Quicksort (median pivot) | O(n^2) | O(log n) stack | No | Yes |
| Heapsort | O(n log n) | O(1) | No | Yes |
If the interviewer pushes on practical use, I would note that std::sort in C++ is introsort, a hybrid of quicksort, heapsort, and insertion sort, chosen because it is in place and fast in practice despite a worse theoretical worst case than merge sort. For nearly sorted data, insertion sort runs in O(n) and beats both. The right answer depends on whether memory, worst-case latency, or average speed is the binding constraint, and I would ask which one the interviewer cares about before defending a single choice.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-13How would you solve a two-sum problem on an array?
Reported in Samsung Electronics Software Engineer interview experience (December 2023)
The 90-second answer
I would clarify three things first: return indices or values, can the same element be used twice, and is the array sorted. Assuming the usual version, return the two indices whose values sum to target, each element used once, exactly one solution exists, and the array is unsorted, I use a single pass with a hash map from value to index. For each value I check whether its complement, target minus value, has already been seen. If it has, I return that earlier index and the current one. Otherwise I store the current value and move on. That is O(n) time and O(n) extra space, and it handles duplicates correctly because I only look up complements seen before the current element.
# Python 3.11
def two_sum(nums: list[int], target: int) -> list[int]:
seen: dict[int, int] = {}
for i, value in enumerate(nums):
complement = target - value
if complement in seen:
return [seen[complement], i]
seen[value] = i
raise ValueError("no pair sums to target")Worked trace
For nums = [3, 2, 4], target = 6:
| Step | i | value | complement | seen before step | Action |
|---|---|---|---|---|---|
| 1 | 0 | 3 | 3 | {} | store 3 -> 0 |
| 2 | 1 | 2 | 4 | {3: 0} | store 2 -> 1 |
| 3 | 2 | 4 | 2 | {3: 0, 2: 1} | complement found, return [1, 2] |
Storing before checking would break the case nums = [3], target = 6, because the single 3 would match itself. Checking first prevents that.
Alternatives and when I would pick them
| Approach | Time | Extra space | When it fits |
|---|---|---|---|
| Brute force, check every pair | O(n^2) | O(1) | Tiny arrays, or memory is so tight that a hash map is not allowed |
| Hash map, one pass | O(n) average | O(n) | Unsorted array, indices required, the default case |
| Two pointers from both ends | O(n) after sorting | O(1) besides sort | Array already sorted, or only values required and sorting cost is acceptable |
For n = 1,000,000, brute force checks about 5 x 10^11 pairs. The hash map version does about 1,000,000 lookups. That gap is why I would not lead with brute force unless the interviewer adds a hard memory limit, for example an embedded target with a few kilobytes of RAM and a small input.
Failure modes I would name
No solution: the code above raises instead of returning a sentinel, and I would state that choice up front. In C or C++ I would also watch integer overflow when computing target - value for values near the type limit, and I would use a wider type or check bounds before subtracting. Duplicate values: [3, 3], target = 6 works because the first 3 is stored before the second is checked. Sorted input with values only: two pointers avoids the hash map entirely, but sorting an unsorted array first costs O(n log n) and loses the original indices unless I sort pairs of value and index.
If the interviewer changes the constraints, I would adapt in that order: sorted array, switch to two pointers; strict memory limit, discuss brute force or external sorting; streaming input where the array does not fit in memory, keep the hash map but expect it to grow with distinct values and say so.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-14How would you solve a recursion problem such as calculating a factorial or Fibonacci sequence?
Reported in Samsung Electronics Software Engineer interview experience (December 2023)
The 90-second answer
I would start by naming the base case and the smaller problem, then check whether the naive recursion repeats work. Factorial and Fibonacci look similar on a whiteboard, but they have opposite complexity, and that difference decides the implementation.
For factorial, n! = n * (n-1)! with 0! = 1. For Fibonacci, fib(n) = fib(n-1) + fib(n-2) with fib(0) = 0 and fib(1) = 1. Both are direct translations of the definition. The interview follow-up is whether you notice that naive Fibonacci recomputes the same values exponentially often.
# Python 3.11, checked against CPython 3.11
from functools import lru_cache
def factorial(n: int) -> int:
if n < 0:
raise ValueError("factorial undefined for negative n")
if n <= 1:
return 1
return n * factorial(n - 1)
def fib_naive(n: int) -> int:
if n <= 1:
return n
return fib_naive(n - 1) + fib_naive(n - 2)
@lru_cache(maxsize=None)
def fib_memo(n: int) -> int:
if n <= 1:
return n
return fib_memo(n - 1) + fib_memo(n - 2)
def fib_iter(n: int) -> int:
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return aWhy naive Fibonacci fails
Trace fib(5) with a call counter. Each call branches into two smaller calls, so the tree grows fast even though the answer is small.
| Call | Returns | Subcalls made |
|---|---|---|
| fib(5) | 5 | fib(4), fib(3) |
| fib(4) | 3 | fib(3), fib(2) |
| fib(3) | 2 | fib(2), fib(1) |
| fib(2) | 1 | fib(1), fib(0) |
| fib(1) | 1 | none |
| fib(0) | 0 | none |
Counting every node in that tree gives 15 calls for fib(5), 177 calls for fib(10), and 242,785 calls for fib(25). The count follows C(n) = C(n-1) + C(n-2) + 1, which is 2*fib(n+1) - 1 and therefore O(2^n). Memoisation stores each fib(k) once, so the same computation drops to O(n) time and O(n) space for the cache plus recursion depth. The iterative version keeps O(1) extra space and avoids recursion depth entirely.
| Approach | Time | Extra space | Stack depth | When I would use it |
|---|---|---|---|---|
| factorial, recursive | O(n) | O(n) | n frames | Teaching the definition, small n |
| factorial, loop | O(n) | O(1) | none | Production code, large n |
| Fibonacci, naive recursion | O(2^n) | O(n) | n frames | Only to show the problem |
| Fibonacci, memoised recursion | O(n) | O(n) | n frames | Clear and fast enough for moderate n |
| Fibonacci, iterative | O(n) | O(1) | none | Embedded or latency sensitive code |
Failure modes I would name before the interviewer asks
Stack overflow is the first. Python's default recursion limit is 1000, so factorial(2000) raises RecursionError even though the maths is fine. In C on a microcontroller, deep recursion can overflow a small stack and corrupt adjacent memory, which is why I would convert to a loop when stack size is constrained. The second failure is integer overflow. 20! is 2,432,902,008,176,640,000, which fits in a signed 64-bit integer, but 21! does not. In C that wraps for unsigned types and is undefined behaviour for signed overflow, so I would either use a wider type, a big integer library, or reject inputs above a stated limit. The third failure is missing or wrong base cases. fib(0) and fib(1) swapped, or a factorial that returns 0 for 0!, passes casual testing and fails the boundary test.
If the interviewer pushes further, I would mention that memoised recursion still uses O(n) stack, so for n in the millions the iterative form is the safe default, and that matrix exponentiation can compute fib(n) in O(log n) time when n is huge and the number of queries is large. For a standard interview answer, though, the point is to show the recursion, then immediately fix its repeated subproblem cost and its stack cost.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-15How does the Node.js event loop work?
Reported in Samsung Electronics Software Engineer interview experience (July 2026)
The 90-second answer
Node.js runs JavaScript on a single thread per process, and that thread does not wait. It registers callbacks for timers, I/O and other events, then loops over queues of ready callbacks. The loop is implemented in libuv, which also owns a small thread pool for work that cannot be done on the JS thread, such as file I/O, DNS lookups and some crypto.
Each iteration runs phases in this order: timers, pending callbacks, idle and prepare, poll, check, and close callbacks. Between every individual callback, Node drains the microtask queue, which holds process.nextTick callbacks first and then promise continuations. That detail decides a lot of ordering bugs.
Worked trace
setTimeout(() => console.log('timer'), 0);
setImmediate(() => console.log('immediate'));
Promise.resolve().then(() => console.log('promise'));
process.nextTick(() => console.log('nextTick'));
console.log('sync');| Step | Output | Why |
|---|---|---|
| 1 | sync | Synchronous code runs before the loop starts |
| 2 | nextTick | Microtask queue drains before the next phase |
| 3 | promise | Promise continuation runs in the same drain |
| 4 | timer | Timers phase runs before check in this context |
| 5 | immediate | Check phase runs setImmediate callbacks |
That timer versus immediate order is not guaranteed in general. From the main module, setTimeout(0) is clamped to 1 ms, so setImmediate often wins. Inside an I/O callback, the loop is already past the timers phase, so setImmediate runs first. Interviewers probe exactly that.
What blocks it, and what does not
// Blocks the loop for about 200 ms. No timer, request or poll callback runs.
const end = Date.now() + 200;
while (Date.now() < end) {}
// Does not block. The read is handed to libuv and the callback fires in poll.
fs.readFile('config.json', 'utf8', (err, data) => { /* ... */ });A 200 ms synchronous loop delays every other request in that process by at least 200 ms. With 50 concurrent requests arriving during it, p99 latency jumps even though CPU use looks modest. The fix is to move CPU work to a worker thread (worker_threads) or a separate process, and to keep handlers free of JSON parsing of huge payloads, regex backtracking and synchronous fs calls.
The libuv thread pool defaults to 4 threads. That is a real ceiling. If you fire 20 fs.readFile or crypto.pbkdf2 calls at once, the extra work queues. Raising UV_THREADPOOL_SIZE (set before Node starts, maximum 1024) helps only when the bottleneck is genuinely pool size. It does not help CPU-bound JS, because that never touches the pool.
Failure modes I would name in an interview
Microtask starvation: a process.nextTick callback that schedules another nextTick callback never lets the loop reach the poll phase. Timers and I/O stop firing while the process looks busy. The same pattern with a self-resolving promise chain has the same effect, though promise callbacks are queued behind nextTick.
Unbounded queues: registering callbacks faster than the loop drains them grows memory without bound. A slow consumer on a stream, or a retry loop with no backoff, shows up as heap growth first and event loop lag second. I would watch eventLoopDelay from perf_hooks and the lag between timer due time and execution, not just CPU.
One process, one thread: scaling means more processes behind a load balancer, or a cluster, not more threads in the same process. That is the trade-off against a threaded server. You get cheap concurrency for I/O and no shared-memory races, and you pay with per-process memory and a hard limit on CPU parallelism per process.
If the interviewer pushes on architecture, the answer is: keep the loop thin, push blocking work to workers or the pool, bound every queue, and measure loop lag directly. That is what keeps a Node service predictable under load.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-16How would you architect a URL shortener?
Reported in Samsung Electronics Software Engineer interview experience (July 2026)
The 90-second answer
I would assume 100 million new short URLs per day, a 100 to 1 read to write ratio, 5 year retention, custom aliases, expiry, and click analytics. That gives about 1,160 writes per second on average and 116,000 redirects per second. Peak is roughly 3 times average, so I design for 3,500 writes and 350,000 redirects per second.
The write path is POST /shorten returning a short code. The read path is GET /{code} returning a 302 to the long URL. I would not use 301 by default. A 301 tells browsers to cache the mapping permanently, which breaks revocation, expiry, and analytics, and makes a compromised link hard to kill. A 302 keeps control on the server. If a customer needs permanent SEO redirects, I offer 301 as an explicit option per link.
ID generation
The code has to be short, unique, and cheap to generate under concurrency. I use a 64-bit counter per shard, encoded in base62. Seven characters give 62^7, about 3.5 trillion codes, enough for 100 million per day for over 90 years. Six characters give 56 billion, about 18 months at that rate, so 7 is the safer default.
# Python 3.11, checked against CPython 3.11
ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def encode(n: int) -> str:
if n == 0:
return ALPHABET[0]
out = []
while n:
n, r = divmod(n, 62)
out.append(ALPHABET[r])
return "".join(reversed(out)).rjust(7, ALPHABET[0])Each shard owns a block of, say, 1 million IDs from a central allocator, so the hot path needs no cross-shard coordination. The trade-off is predictability. Sequential codes are enumerable, so I add a random offset per block and, for sensitive links, generate a random 7 character code and rely on a unique index to retry on collision. Hashing the long URL is worse here. It needs collision handling anyway, it leaks nothing useful, and the same URL shortened twice should usually get two codes.
| Choice | Uniqueness | Cost under load | Weakness |
|---|---|---|---|
| Sharded counter, base62 | Guaranteed by allocator | One local increment | Enumerable if offset is skipped |
| Random code + unique index | Probabilistic, retry on conflict | Extra insert retry on collision | Needs retry loop, wasted codes |
| Hash of long URL | Not guaranteed | Hash plus lookup | Collisions, duplicate handling |
Storage and redirect path
The table is short_links(code, long_url, owner_id, created_at, expires_at, status). I partition by hash of code across Postgres shards, with a unique index on code. At roughly 500 bytes per row including indexes, 100 million rows per day is about 50 GB per day, or 18 TB per year before replication. That is why partitioning and archive to object storage after expiry matter from day one.
Redirects hit a Redis cache first, keyed by code, with a 24 hour TTL and negative caching for misses. A viral link is the main failure mode. One code can take a large share of 350,000 reads per second, so I add CDN caching at the edge for hot codes and request coalescing on cache miss, where one request fills Redis while others wait briefly instead of all hitting the database. Without coalescing, a popular link expiring from cache creates a stampede.
Clicks go to a queue as fire and forget events, not inline in the redirect. Writing analytics synchronously would add a database write to every redirect and turn an analytics outage into a redirect outage. The queue consumer batches into the analytics store, and the redirect path only fails if the cache and database are both unavailable.
Abuse and failure modes
Shorteners attract phishing and spam, so creation needs authentication, per account rate limits, and URL validation at creation time, plus a blocklist check on the long URL. I would also scan on redirect for newly reported malicious destinations and flip status to blocked, which only works because I chose 302.
Two other failures to name in the interview: allocator failover must not hand out the same block twice, so block allocation is a transactional update of the high water mark, and clock based expiry needs a sweeper job rather than relying on reads to clean up, since expired codes still occupy the unique index until deleted.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-17How do you prioritize work and handle ambiguity?
Reported in Samsung Electronics Software Engineer interview experience (July 2026)
The 90-second answer
I separate two problems. Prioritization is deciding what not to do this cycle. Ambiguity is deciding how much information to buy before I commit.
For prioritization I score work on impact, deadline pressure, dependency risk, and reversibility, then I make the trade-off visible to the team. For ambiguity I timebox discovery, write down the assumption I am acting on, and set a date or signal that would change the decision. I do not wait for a perfect spec, and I do not guess silently.
A concrete case from device software: we had a Galaxy feature branch, a firmware fix from a hardware team, and a certification blocker, all competing for the same two engineers in one sprint. The firmware fix blocked the feature branch, so it went first even though its user impact looked smaller. The certification blocker had a hard external date, so it got a daily check-in. The feature work was cut to the smallest demoable slice.
How I score it
I use a simple weighted score so the discussion is about the numbers, not about who argues loudest. The figures below are from a hypothetical sprint, labelled as such.
# Python 3.11, checked against the scoring used in the table below
def score(impact, urgency, dependency_risk, reversibility):
# each input is 1 (low) to 5 (high); reversibility 5 means easy to undo
return 0.4 * impact + 0.25 * urgency + 0.2 * dependency_risk + 0.15 * reversibility
print(score(5, 4, 5, 3)) # 4.45| Work item | Impact | Urgency | Dependency risk | Reversibility | Score | Decision |
|---|---|---|---|---|---|---|
| Firmware fix blocking feature branch | 3 | 4 | 5 | 3 | 3.65 | Do first |
| Certification blocker, external date | 4 | 5 | 2 | 4 | 3.85 | Do first, daily check |
| New feature slice | 5 | 2 | 1 | 5 | 3.45 | Cut to demoable slice |
| Nice-to-have polish | 2 | 1 | 1 | 5 | 2.00 | Defer |
The score does not decide alone. A blocker with dependency risk 5 can outrank a higher impact item because everything downstream waits on it. If two scores land within 0.3, I ask the product owner which risk they would rather carry, and I record that choice.
Handling ambiguity
In practice that means I ask three questions early: who is the user, what happens if we ship late, and what would prove this approach wrong. If nobody can answer the third one, the request is not ready to code. I then pick the cheapest probe. For an API question that might be a contract sketch reviewed by the client team. For a performance question it might be a benchmark on a real device rather than a desktop estimate.
I also keep a short decision log in the ticket: assumption, owner, expiry. Example: "Assuming the hardware team delivers the new sensor driver by 12 May. If it slips, we ship without the low-power mode. Owner: me. Review: 12 May standup." That turns ambiguity into a tracked risk instead of a surprise in week three.
Failure modes I watch for
Analysis paralysis: discovery stretches past the timebox with no prototype. I stop it by forcing a demo or a measurement at the deadline.
Silent assumptions: I coded against a guessed requirement and discovered the mismatch at integration. The decision log and a mid-sprint review with the requester prevent that.
Priority churn: everything becomes P0. I cap the number of P0 items per sprint, usually at two, and anything new has to displace something explicitly.
When I escalate, I bring the scored list, the assumption log, and the cost of waiting. That gives a manager or product owner a decision to make, not a vague problem to solve.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-18Why did you want to join Samsung Electronics specifically?
Reported in Samsung Electronics Software Engineer interview experience (August 2025)
The 90-second answer
I applied to Samsung Electronics because the work I want next sits below the app layer. For the last two years I built an Android app in Kotlin with about 2 million monthly users. We shipped camera features, but we tested on roughly 40 models and hit memory and battery ceilings we could not move. The fix usually lived in a HAL or a vendor library we did not own. At Samsung Electronics I can work on One UI, Galaxy AI, or platform code that ships on hundreds of millions of Galaxy devices, and sit closer to the teams that own the display, modem and silicon. A 5 ms regression in a camera pipeline is a minor bug on one phone. On a Galaxy flagship it becomes a field issue, and the fix has to hold across Exynos and Snapdragon variants. That scale and that hardware loop are the specific draw.
What I would do first
I would pick one measured path and own it end to end, rather than proposing a rewrite in week one.
If I joined MX, I would ask for a jank or battery trace from the field, reproduce it on a lab device, and land a fix with a trace attached. If I joined the semiconductor or display side, I would do the same with a driver or firmware path. The pattern is the same. Find the metric the team already watches, then move it.
| My background | Where it maps at Samsung Electronics | First measurable contribution |
|---|---|---|
| Camera and media pipeline in Kotlin, 2M monthly users | One UI and Galaxy camera software | Reduce frame drops in a preview path on a target device, shown with a trace |
| Cut APK size 18% by splitting assets and removing unused resources | System apps and Galaxy Store | Shrink install size for one system app without breaking offline use |
| Fixed a leak from heap dumps, about 40 MB saved in a long session | SmartThings, wearables, Tizen apps | Add a leak check to CI for the module I touch |
Why Samsung Electronics over a concrete alternative
I compared Samsung Electronics with two other offers I considered. The first was a pure software company building a consumer app on top of Android. The second was a smaller OEM where I would have been one of three Android engineers.
| Criterion | Samsung Electronics | Pure software company | Smaller OEM |
|---|---|---|---|
| Device scale | Hundreds of millions of Galaxy devices, plus TVs and wearables | Millions of users, one app | Tens of thousands of units |
| Access to hardware | In-house display, memory, modem and SoC teams in the same group | None, works through public APIs | Some, but a small platform team |
| Iteration speed | Slower, release gates tied to hardware launches | Fast, weekly releases | Medium, tied to one product line |
| Ownership | Narrow scope at first, wider after proving impact | Broad scope early | Broad scope early |
I chose Samsung Electronics because scale and hardware access outweigh iteration speed for the next three years. I have already had fast iteration and broad ownership. I have not had to make a change hold across form factors, hinge states on foldables, and two SoC vendors. Foldables show why that matters. Supporting a cover screen and a main screen touches window management, activity lifecycle and testing across postures. That is the problem I want to learn.
This reasoning would not hold if my priority were shipping a feature every week, or if I wanted research freedom to publish. Samsung Electronics moves on hardware schedules, and much of the platform work is internal. If I later decide I want that pace, I should not join, and I would be honest about that in a follow-up conversation.
What could go wrong, and how I would detect it early
There are three failure modes I am watching for, and I would ask about each before accepting.
First, team assignment. Large groups can place a new hire on maintenance of a legacy module with no path to a measured project. I would ask what the last three new hires on the team shipped in their first six months, and what the team metric is for this quarter. If the answer is vague, that is a signal.
Second, launch freeze. Work around a flagship launch can mean months of bug fixing with little design input. That is survivable if I know the dates early. I would ask for the release calendar and how on-call is staffed during freeze. If on-call is unpaid overtime with no rotation, the cost is higher than the job description suggests.
Third, my own fit. I have worked in English speaking teams. Some Samsung Electronics teams in Suwon work primarily in Korean, with English for documentation. I would ask what language code review and design docs use, and whether I would have a mentor for the first quarter. If the answer is that I would be expected to work in Korean from day one, I would need to be realistic about my ramp time.
I am not joining for a title. I know release gates are strict because a bad system update reaches a huge installed base, and I know the pace around launch windows is demanding. I want to learn to ship under that bar. If I am doing well in six months, I should be able to name a device, a metric and a test that proves the change. That is the standard I am applying for.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-19How would you handle conflict in a team?
Reported in Samsung Electronics Software Engineer interview experience (April 2026)
The 90-second answer
I separate the technical disagreement from the relationship, and I try to resolve it while the cost of being wrong is still low. First I check whether I actually understand the other person's constraint. Then I put both options against the same criteria we already agreed on, like latency budget, maintenance cost, or release risk. If the data does not settle it, I propose a small experiment or a time-boxed decision and escalate early, with both positions written down, rather than letting it become a hallway argument.
A concrete case from firmware work: a teammate wanted to poll a sensor every 10 ms on a shared I2C bus. I wanted an interrupt-driven read because polling was already pushing bus utilisation past 70% at peak load. We did not argue about preference. We measured. On a logic analyser, polling added about 1.8 ms of bus traffic per cycle and delayed a higher priority transaction by up to 12 ms. The interrupt version used under 5% of the bus. That ended the debate in one afternoon, and he was the one who suggested we keep the measurement in the design doc so the next team would not reopen it.
How I run it in practice
The restatement step matters more than it sounds. If I say, "You are worried polling will miss a wake-up event during a 200 ms sleep window," and he confirms that, we are now solving the same problem. If I skip it, I end up rebutting a version of his argument he never made.
| Conflict type | What it usually sounds like | My first move |
|---|---|---|
| Technical, same goal | "Your approach is slower" | Agree on the metric, then benchmark both |
| Technical, different goals | "We need it this sprint" vs "We need it maintainable" | Make the trade-off explicit: scope, date, or quality, pick one |
| Ownership or credit | "That was my design" | Go to the artefact: commit history, design doc, who wrote what |
| Working style | "You never respond in chat" | Agree on a channel and response norm for the task, not a personality verdict |
What I do when I am the one who is wrong
I say so in the same thread where the decision was made, not in a private message later. Something like: "The benchmark came back at 40 ms p99, not the 12 ms I estimated. Your polling design meets the budget. I will update the doc and switch my branch." That costs me a little pride and saves the team a week of suspicion about whether I will quietly relitigate it.
Failure modes I watch for
The first is silent disagreement. If a teammate goes quiet in a review and then implements something different in their own branch, the conflict has not been resolved, it has been deferred to integration. I treat a quiet review as a signal to ask directly: "What would make this fail in production?" before the meeting ends.
The second is escalation as a weapon. Going to a manager with "he blocked me" instead of "here are two options, here is my recommendation, here is the decision I need by Thursday" just moves the argument up a level and damages trust. Escalation is for a decision the team cannot make, not for winning one.
The third is winning the argument and losing the implementation. If I push through a design the implementer does not believe in, I get a correct-looking implementation with the corners cut in exactly the places he was worried about. When the stakes allow it, I would rather accept the second-best design that the owner will build well, and note the revisit trigger: "If p99 exceeds 50 ms under load, we switch to interrupts."
A worked trace of one escalation
| Day | Action | Artefact |
|---|---|---|
| 1 | Disagreement in design review, both positions stated | Meeting notes with both options |
| 2 | Joint benchmark, 3 runs each, results in a shared sheet | Numbers, not opinions |
| 3 | Still tied within 5%, written one-pager to tech lead | Recommendation plus dissent noted |
| 4 | Lead picks option B, we both commit in the thread | Decision recorded in the design doc |
That last line is the habit I would bring here. Samsung ships hardware on tight schedules, and a team that can disagree in writing, decide quickly, and move on will beat a team that avoids conflict until the release branch is cut.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-20Walk me through your background: education, key roles, and what shaped your career path?
Reported in Samsung Software Engineer Interview — Onsite | Screna AI
I studied computer science, with most of my coursework in operating systems and computer architecture. My final-year project is the reason I ended up in systems work. I built a controller on a Cortex-M4 board with 128 KB of SRAM. It sampled a temperature sensor every 10 milliseconds, ran a PID loop, and logged over UART. I had no room for sloppy allocation, so I learned to read linker maps, check stack use, and time code with a GPIO pin and a scope. That habit stuck.
My first job was firmware for a device that shipped in the low hundreds of thousands of units. I owned the bootloader and drivers for I2C and SPI peripherals, written in C. Product asked us to cut cold boot from 2.8 seconds to under 1.5 seconds. I measured first. Sensor initialisation took about 1.9 seconds of that, done one device at a time on a single bus.
I considered two options. I could cache sensor readings from the previous shutdown, which would have been fast but wrong after a long power-off, because the sensors drift and the first reading after power-on is the one the safety check depends on. I went with parallel initialisation across two I2C buses instead. It cost us a second bus, more driver code, and a harder bring-up, because now two state machines ran at once. Boot fell to 1.31 seconds on the median of 50 runs.
The failure mode showed up in hardware-in-the-loop testing, not on my desk. At minus 10 degrees Celsius one sensor needed extra settling time, and the parallel code timed it out and marked the board as failed. We caught it because the HIL rig ran a temperature sweep, and we fixed it by giving that sensor a longer wait and a retry. I also added a CI check that fails if median boot on the reference board goes above 1.6 seconds. That check has a real cost. The rig needs maintenance, a board occasionally dies, and someone has to update the threshold when hardware changes. We accepted that because without it the boot time crept back up within two releases.
Three years ago I moved to platform services. I now write Go services that ingest telemetry from those devices, about 40,000 messages a minute at peak, and the OTA update pipeline. The problem I spent the most time on was devices retrying an update acknowledgement after a network drop. The server treated each retry as new, so device state got out of sync and some devices were offered the same firmware twice.
I made the acknowledgement handler idempotent, keyed on device ID plus firmware version, and stored the response so a duplicate gets the same answer back. The trade-off is storage and a small lookup on every acknowledgement, and we had to decide how long to keep those records. Keeping them for 24 hours covered almost all retries, but a device that stayed offline for a week and then replayed an old acknowledgement could still slip through. We logged the duplicate rate, about 0.4 percent of acknowledgements before the change, and reviewed it weekly for a month. It fell to near zero, and the stuck-update tickets dropped with it. The remaining risk is a device with a corrupted version string, which now looks like a new device. We detect that by alerting on devices that request firmware they already reported installing.
What shaped my path, if I had to name it, is that I keep choosing work where the budget is concrete. Memory on the board, boot time, message rate, duplicate rate. I am comfortable moving between the firmware and the service because the questions are similar. What is the limit, how do I measure against it, and what breaks when I push past it. That is the kind of work I want to keep doing, and it is why I applied here.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-21What are your top strengths, and can you give a concrete example of each one in action?
Reported in Samsung Software Engineer Interview — Onsite | Screna AI
The 90-second answer
I would name three strengths I can prove with work I shipped: debugging under tight resource limits, delivering features with other engineers without creating rework, and learning an unfamiliar stack fast enough to contribute in the first month. I will give one concrete example for each, with the numbers I measured.
1. Debugging under resource limits
In my last Android role, our app was crashing on low-end devices with 2 GB of RAM. The crash rate was 2.1% of sessions on those devices and near zero on flagships, so the bug was not in the main flow. I reproduced it on a Galaxy A04 test device, captured a heap dump after 20 minutes of scrolling a feed, and found retained bitmaps in a RecyclerView cache that grew from 40 MB to 310 MB. The cache keyed on image URL but never evicted when the activity was recreated on rotation.
I changed the cache to a size-capped LRU at 48 MB, moved bitmap decoding to a shared scope, and added a regression test that rotates the activity 50 times and asserts heap growth stays under 60 MB. After release, the crash rate on 2 GB devices fell to 0.3% over four weeks, and p95 cold start stayed at 900 ms because the smaller cache did not add decode work on the main thread. That is the pattern I use: reproduce on the constrained device, measure the resource, fix the retention path, then lock it in with a test.
2. Shipping with a team without creating rework
On a payments feature, I owned the client side and a teammate owned the server API. We had a two-week deadline and the API contract was still moving. Instead of waiting, I wrote the contract as a small schema file we both reviewed, generated mock responses from it, and built my UI against the mocks. When the server team changed one field name in week two, my change was a one-line update to the generated model rather than a rewrite of the screen logic.
We also agreed on a rule early: any breaking change needed a joint review before merge. That sounds slow, but it saved us. We caught a mismatch where the server returned amounts in paise and my client formatted them as rupees. The review caught it before integration testing, and we shipped on the original date with no hotfix in the first release.
3. Learning a new stack quickly
When I joined a team using Kotlin coroutines for the first time, I had only used callbacks before. In my first month I read the internal guide, paired on two small tasks, and took a bounded piece of work: migrating one screen from callbacks to structured concurrency. I kept the old code behind a flag, migrated one data load at a time, and measured cancellation behaviour with a test that left the screen mid-request.
The migrated screen stopped leaking a request after the user navigated away, which I verified by counting active jobs in a debug build. By month two I was reviewing coroutine code for others. I do not claim I learned it in a weekend. I claim I can pick a small, reversible slice, learn the idiom on that slice, and then apply it more widely.
| Strength | Evidence I can point to | Result I measured |
|---|---|---|
| Debugging under limits | Heap dump, LRU cache fix, rotation regression test | Crash rate 2.1% to 0.3% on 2 GB devices |
| Team delivery | Shared schema, mocks, joint review rule | Shipped on date, no first-release hotfix |
| Fast learning | Flagged coroutine migration, cancellation test | No leaked request after navigation |
If you want, I can go deeper on any one of those, including the heap trace or the contract review process.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-22What is a genuine weakness you have, and what are you actually doing to work on it?
Reported in Samsung Software Engineer Interview — Onsite | Screna AI
The 90-second answer
My genuine weakness is that I used to start coding before I had pinned down the interface I was coding against. On a firmware-adjacent project that meant I would build a driver against my own assumption about a sensor register map, discover at integration that the hardware team had meant something else, and lose a week reworking it. I have changed how I work, and I can show the change in numbers from my last two projects.
The weakness was not lack of effort. It was sequencing. I treated ambiguity as something to resolve by writing code, when at a hardware and software boundary ambiguity is cheaper to resolve on paper. The fix I now use is a short interface note before any implementation starts.
What I actually do now
For any task that touches an external interface, a shared data structure, or another team's API, I write a one page note first. It lists the inputs and outputs, the error cases, who owns each field, and the one assumption I am least sure about. I send it to the owner for a 20 minute review, then prototype only the riskiest path. Only after that do I write the full implementation.
Evidence it is working
These are figures from my own project tracking, labelled as my experience rather than a general claim:
| Signal | Before the change | After the change |
|---|---|---|
| Integration defects found after code complete | 6 per project | 1 to 2 per project |
| Rework after first integration run | 4 to 6 days | 1 day |
| Review comments on interface assumptions | 9 on one review | 2 on the next comparable review |
| Time from ticket to first working demo | 9 days | 7 days, despite the extra note |
The demo time falling matters to me. The note costs half a day, but it removed the late discovery that used to add a week. My lead started asking me to share the template with two junior engineers, which was a better sign than the numbers alone.
What I still get wrong
I still catch myself drafting code in my head while writing the note. When the task is small and the interface is entirely mine, I skip the note, and that is deliberate. When the interface belongs to someone else, I do not skip it now. If an interviewer at Samsung asked me to work on a display or modem interface, I would expect the same discipline to apply, because the cost of a wrong assumption grows with the number of teams downstream.
I am not claiming the habit is finished. I still need to be prompted occasionally to write the note before the prototype, and I keep a checklist in my task tracker so the step does not depend on my memory under deadline pressure.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-23Explain graph traversal concepts like BFS and DFS?
Reported in Samsung Electronics Software Engineer interview experience (July 2024)
The 90-second answer
Both visit every reachable vertex once and examine every edge once, so both run in O(V + E) time for an adjacency list. They differ in visit order and in what they remember while doing it.
BFS uses a queue. It visits all neighbours of a node before their neighbours, so it expands in rings around the start. That makes it the natural choice for shortest path in an unweighted graph, for level order, and for the nearest node satisfying a condition.
DFS uses a stack, written recursively or iteratively. It follows one branch to its end before backtracking. That makes it natural for connected components, cycle detection, topological sort, and path search where a branch must be explored fully before trying another.
Assume a directed or undirected graph stored as an adjacency list, dict[node, list[node]]. A visited set is mandatory in both, otherwise a cycle loops forever.
from collections import deque
def bfs(graph, start):
seen = {start}
queue = deque([start])
order = []
while queue:
node = queue.popleft()
order.append(node)
for nxt in graph[node]:
if nxt not in seen:
seen.add(nxt)
queue.append(nxt)
return order
def dfs(graph, start):
seen = set()
stack = [start]
order = []
while stack:
node = stack.pop()
if node in seen:
continue
seen.add(node)
order.append(node)
# Push reversed so neighbours pop in listed order.
for nxt in reversed(graph[node]):
if nxt not in seen:
stack.append(nxt)
return orderWorked trace
Graph: A -> B, C; B -> D; C -> D; D -> E. Neighbours listed alphabetically. BFS marks a node seen when it is enqueued. DFS marks a node seen when it is popped, and checks seen before pushing.
BFS trace:
| Step | Dequeued | Queue after step | Order so far |
|---|---|---|---|
| start | [A] | ||
| 1 | A | [B, C] | A |
| 2 | B | [C, D] | A, B |
| 3 | C | [D] | A, B, C |
| 4 | D | [E] | A, B, C, D |
| 5 | E | [] | A, B, C, D, E |
At step 3, C tries to enqueue D, but D is already seen from step 2, so the queue only holds D.
DFS trace:
| Step | Popped | Stack after step | Order so far |
|---|---|---|---|
| start | [A] | ||
| 1 | A | [C, B] | A |
| 2 | B | [C, D] | A, B |
| 3 | D | [C, E] | A, B, D |
| 4 | E | [C] | A, B, D, E |
| 5 | C | [] | A, B, D, E, C |
At step 1, A pushes C then B, so B pops first. At step 5, C tries to push D, but D is already seen, so nothing is pushed. BFS returns A B C D E. DFS returns A B D E C. Same vertices, different order, because the queue releases B and C before D, while the stack holds C back until the B branch finishes.
Choosing between them
| Question | Use | Why |
|---|---|---|
| Shortest path, unweighted | BFS | First time a node is reached is via fewest edges |
| Level by level, nearest match | BFS | Distance from start is implicit in the level |
| Connected components, islands | Either | Both mark a whole component; BFS uses more memory on wide graphs |
| Cycle detection, topological sort | DFS | Needs entry and exit times on a branch |
| Maze or path with backtracking | DFS | Depth-first matches the search and undo pattern |
| Deep graph, limited stack | BFS or iterative DFS | Recursive DFS can overflow the call stack |
Failure modes I check for
Disconnected graphs: starting from one node never reaches the rest. Loop over all vertices and start a new traversal for each unvisited one. That is how you count components instead of silently returning a partial order.
Cycles and self loops: without the visited set, BFS enqueues the same node repeatedly and DFS loops. Mark visited when a node is enqueued in BFS, not when it is dequeued, or a node with two parents gets enqueued twice.
Recursion depth: recursive DFS on a chain of 100,000 nodes will hit Python's default recursion limit of 1,000 and C++ stack limits in embedded code. The iterative version above avoids that, at the cost of an explicit stack that can itself grow to O(V) on a wide graph.
Memory: BFS queue and DFS stack both hold O(V) in the worst case, plus O(E) for the adjacency list. For a dense graph, an adjacency matrix costs O(V^2) space and makes neighbour scans O(V) per node, so the adjacency list is the default unless V is small and edge lookups dominate.
In an interview I would state the graph representation first, then give the iterative code, then trace a small graph as above. That shows the order difference concretely instead of just naming queue and stack.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-24Explain compiler algorithms and LRU caching?
Reported in Samsung Electronics Software Engineer interview experience (July 2024)
The 90-second answer
Compiler algorithms turn source text into machine code in stages, and each stage trades compile time against the speed or size of the generated program. LRU caching is a separate technique for keeping the most recently used items in a small, fast store and evicting the least recently used one when it fills. I would treat them as two topics, because the interviewer is usually checking whether I can explain a pipeline and a data structure, not whether I can force a connection between them.
Compiler pipeline
The lexer scans characters with a deterministic finite automaton and emits tokens, discarding whitespace and comments. The parser builds a syntax tree. Recursive descent gives LL parsing and is easy to debug, while LR parsing with LALR tables handles larger grammars and reports errors closer to the offending token. The cost is table size and generator complexity, which is why hand written recursive descent is common for small languages and generated LR parsers for C and Java.
The middle end works on intermediate representation, often in SSA form where each value is assigned once. That form makes data flow analysis direct. Constant folding replaces 2 + 3 with 5 at compile time. Dead code elimination removes assignments never read. Inlining copies a small callee into its caller, which can remove call overhead but can also bloat code size and hurt instruction cache locality if done aggressively. Loop invariant code motion hoists a computation that does not change across iterations. Each pass is typically linear or near linear in the size of the IR, so running many passes on a large translation unit is where compile time goes.
The back end selects target instructions, schedules them to hide latency, and allocates registers. Register allocation is the hard part. It is usually modelled as graph colouring: values that are live at the same time get different registers, and if the graph needs more colours than the machine has registers, the compiler spills a value to the stack. Spilling is correct but slow, so a bad allocation can turn a register bound loop into a memory bound one. On embedded targets, which matter at Samsung, the same trade off appears with code size. An optimisation that makes code 10 percent faster but 40 percent larger can be the wrong choice for a device with a small flash budget.
LRU cache
LRU keeps a fixed capacity set of keys. A hit moves the key to the most recently used position. A miss inserts it there, and if the cache is full, the least recently used key is evicted. The standard implementation pairs a hash map from key to node with a doubly linked list ordered by recency. Both operations are O(1) average time.
from collections import OrderedDict
class LRUCache:
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = OrderedDict() # oldest first, newest last
def get(self, key):
if key not in self.cache:
return -1
self.cache.move_to_end(key)
return self.cache[key]
def put(self, key, value):
if key in self.cache:
self.cache.move_to_end(key)
self.cache[key] = value
if len(self.cache) > self.capacity:
self.cache.popitem(last=False) # evict least recently usedWorked trace with capacity 3, assuming a miss returns -1:
| Step | Operation | Result | Cache, oldest to newest |
|---|---|---|---|
| 1 | put(A, 1) | inserted | A |
| 2 | put(B, 2) | inserted | A, B |
| 3 | put(C, 3) | inserted | A, B, C |
| 4 | get(A) | 1 | B, C, A |
| 5 | put(D, 4) | evicts B | C, A, D |
| 6 | get(B) | -1 | C, A, D |
| 7 | put(C, 30) | updates, moves to newest | A, D, C |
If a workload makes 1,000 lookups and 920 hit, the hit rate is 92 percent. At 50 ns for a cache hit and 80 microseconds for a backing store read, the average lookup time is about 0.92 times 50 ns plus 0.08 times 80 microseconds, roughly 6.4 microseconds. That arithmetic is why hit rate, not raw cache speed, decides whether the cache is worth having.
Where the two meet, and where they do not
Compilers do use caching, but mostly memoisation and incremental builds: caching parse results for unchanged files, or caching template instantiations. Hardware instruction and data caches also reward the locality that good code generation creates. That is different from an LRU policy in software. LRU fails in predictable ways. A sequential scan through a large file evicts useful entries, called scan pollution, and a workload whose working set is larger than the cache thrashes, with a hit rate near zero no matter how recent the accesses are. LFU handles repeated hot keys better but can keep a once hot key forever. FIFO is simpler and avoids the cost of updating recency on every hit, but it can evict a key that is about to be reused. In a multithreaded service, the hash map and list must be guarded by one lock or sharded, otherwise a concurrent get and put can corrupt the list order. For an interview follow up, I would name the alternative I would pick for the workload in front of me and say what measurement, usually hit rate under a replayed trace, would prove it right.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-25How would you design a deployment pipeline that lets a team roll back quickly if a release fails?
Reported in Samsung Electronics Software Engineer interview experience (September 2026)
The 90-second answer
I would make rollback a normal path in the pipeline, not a manual rescue. Every build produces one immutable artifact, tagged by commit SHA and semantic version, promoted unchanged through test, staging, canary and production. The pipeline records which artifact is live in each environment, so rolling back means repointing traffic to the previous artifact, not rebuilding it. I would target a rollback under five minutes for a stateless service, and I would rehearse it on every release.
How the rollout is gated
The canary is the decision point. Traffic shifts in steps, and each step has a fixed soak time and a hard gate. If the gate fails, the pipeline stops and reverts automatically. A human can also trigger the same revert with one command.
| Stage | Traffic | Soak time | Gate to continue |
|---|---|---|---|
| Internal dogfood | 1 percent | 30 minutes | No crash reports, smoke tests pass |
| Canary | 5 percent | 15 minutes | 5xx rate within 0.1 percentage points of baseline, p99 latency under 200 ms |
| Regional rollout | 25, then 50 percent | 30 minutes per step | Error budget burn under 2x, key business metrics flat |
| Full rollout | 100 percent | 24 hours of heightened alerts | Manual sign-off from release owner |
Those figures are the kind I would tune from the service's own baseline. The point is that the thresholds are written in the pipeline config before the release, not invented during an incident.
What makes the revert safe
Three details decide whether a five minute rollback actually works. First, database changes follow expand and contract. A release adds new columns or tables and writes to both old and new fields. The old code keeps running against the new schema. A later release drops the old fields only after the new version is fully rolled out. A rollback that has to undo a destructive migration is not a rollback.
Second, config and secrets are versioned separately from code, and the previous config is kept alongside the previous artifact. Third, feature flags sit in front of risky behaviour changes, so a bad code path can be switched off without reverting the whole service. For a Samsung product team shipping to devices, I would apply the same idea to firmware or app releases: staged OTA waves by region and model, with the previous signed image retained on the server and a forced downgrade path tested on internal devices.
A minimal pipeline sketch:
jobs:
deploy:
steps:
- run: ./scripts/deploy.sh --version ${{ github.sha }} --canary 5
- run: ./scripts/check-gate.sh --version ${{ github.sha }}
id: gate
- if: failure() && steps.gate.outcome == 'failure'
run: ./scripts/rollback.sh --to ${{ vars.PREVIOUS_VERSION }}Failure modes I would name in the interview
Rollback fails in practice for predictable reasons. Schema drift: a migration already dropped a column, so the old binary crashes on startup. Detection: the deploy job itself fails, which is why the rollback step keys off the gate result, not off someone noticing an alert. Client skew: an app or firmware release cannot be rolled back on devices that already updated, so the server must stay compatible with the previous client for at least one release cycle. Cache poisoning: a bad release writes bad data into cache or a queue, and reverting code does not clear it, so the runbook needs a cache purge and a queue drain step tied to the same version tag.
I would also keep a release ledger: artifact SHA, config version, migration IDs, who approved each stage, and the exact rollback command. After any rollback, the next release is blocked until the team has a root cause and a regression test that would have caught it in staging. That turns a fast revert into a fix, rather than a repeat of the same incident.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Curated: · Written: · Reviewed: