Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 926–950 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Can interfaces have private methods (C# 8+)? If so, why?

Short answer: Yes, C# 8 introduced private methods in interfaces. Explain a bit more Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string messa…

Mid PDF
How do abstract classes relate to abstract factories or strategy patterns?

Short answer: Abstract classes often define base contracts or template methods for patterns: Abstract Factory: Defines abstract methods to create families of objects. Strategy Pattern: Abstract class defines a common int…

Mid PDF
How does OOP enable microservice isolation and autonomy?

Short answer: Encapsulation and abstraction hide implementation details, exposing only necessary interfaces. Polymorphism allows replaceable modules, facilitating microservices independently deployed and evolved. SOLID p…

Mid Detailed
How do you find the maximum subarray sum (Kadane’s algorithm)?

Short answer: Kadane’s algorithm: keep a running sum; if it goes negative, reset to 0 (or start fresh at the next element). Track the best running sum seen. This finds the contiguous subarray with maximum sum in O(n). Pr…

Arrays & DP Read answer
Mid Detailed
Explain Product of Array Except Self without division.

Short answer: Build prefix products from the left and suffix products from the right. For index i, answer[i] = prefix[i] * suffix[i]. You can do it with one output array and one running suffix to achieve O(1) extra space…

Arrays & Prefix Read answer
Mid Detailed
How do you solve 3Sum?

Short answer: Sort the array. Fix one number, then use two pointers on the remainder to find pairs that sum to −fixed. Skip duplicates carefully to return unique triplets. Overall O(n²). Interview approach Sort ascending…

Two Pointers Read answer
Mid Detailed
Explain Container With Most Water.

Short answer: Two pointers at both ends. Area = min(height[L], height[R]) * (R − L). Move the pointer at the shorter line inward, because width shrinks and only a taller line can improve area. O(n) time. Complexity Time…

Two Pointers Read answer
Mid Detailed
How do you find the longest substring without repeating characters?

Short answer: Sliding window with a map/set of characters in the current window. Expand right; when a duplicate appears, shrink left until the window is unique again. Track max window length. Sample solution C# int Lengt…

Sliding Window Read answer
Mid Detailed
How do you validate a Binary Search Tree?

Short answer: Each node must lie within an allowed (low, high) range. Recurse left with high = node.val and right with low = node.val. Alternatively, inorder traversal must produce a strictly increasing sequence. Complex…

Trees Read answer
Mid Detailed
How do you solve Number of Islands?

Short answer: Scan the grid. When you find a '1', increment island count and DFS/BFS to sink (mark visited) the entire connected land component. Count how many times you start a flood fill. Complexity Time O(rows * cols)…

Graphs / Grid DFS Read answer
Mid Detailed
Explain Course Schedule (detect cycle in a directed graph).

Short answer: Model prerequisites as a directed graph. Detect a cycle with DFS colors (white/gray/black) or Kahn’s algorithm (BFS indegrees). If a cycle exists, you cannot finish all courses. Complexity Time O(V + E), Sp…

Graphs Read answer
Mid Detailed
Explain the Coin Change problem.

Short answer: Unbounded knapsack DP: dp[a] = minimum coins to make amount a. For each coin, update dp[x] = min(dp[x], dp[x - coin] + 1). Initialize dp[0] = 0 and others to +∞. Return -1 if unreachable. Complexity Time O(…

Dynamic Programming Read answer
Mid Detailed
Explain Merge Intervals.

Short answer: Sort intervals by start. Scan and merge when the next start ≤ current end; otherwise push current and start a new one. O(n log n) from sorting. Sample solution C# int[][] Merge(int[][] intervals) { Array.So…

Intervals Read answer
Mid Detailed
How do you search in a rotated sorted array?

Short answer: Modified binary search: check which half is sorted, then decide whether the target lies in that sorted half. Still O(log n). Interview approach Compute mid. If left half sorted (nums[lo] ≤ nums[mid]): if ta…

Binary Search Read answer
Mid Detailed
Explain Word Search on a board (backtracking).

Short answer: DFS from each cell matching the first letter. Mark visited, explore 4 directions for the next character, then unmark (backtrack). Return true as soon as the word is completed. Complexity Time roughly O(N *…

Backtracking Read answer
Mid Detailed
Explain Implement Trie (Prefix Tree).

Short answer: Each node has children map/array[26] and an isEnd flag. insert/search/startsWith walk character by character. Tries shine for autocomplete and dictionary prefix queries. Complexity Time O(L) per operation (…

Tries Read answer
Mid Career Detailed
How to become a Tech Lead?

Short answer: A Tech Lead balances architecture quality, delivery predictability, and team growth. You need strong technical depth plus execution leadership under constraints. Show that you can make decisions, align stak…

Career Growth Read answer
Mid Career Detailed
How to become an Engineering Manager?

Short answer: Engineering Managers are accountable for team performance, people growth, and delivery health. This shift requires moving from individual output to systems of execution and coaching. You still need technica…

Career Growth Read answer
Mid Career Detailed
How to improve communication skills?

Short answer: Career communication improves through structured thinking, concise speaking, and intentional listening. Strong communicators reduce confusion, unblock teams faster, and build trust across levels. Treat comm…

Career Growth Read answer
Mid
How do you remove the Nth node from the end of a linked list?

Short answer: Two pointers with a gap of n. Advance fast n steps, then move both until fast hits the end; slow.next is the node to delete. One pass, O(1) space. Edge cases to mention Remove head (n == length) Single node…

Linked Lists Read answer
Mid
Explain Binary Tree Level Order Traversal (BFS).

Short answer: BFS with a queue. Process level size at a time, enqueue children, and collect values per level into a list of lists. Complexity Time O(n), Space O(n) for the queue/result. Common follow-ups Zigzag level ord…

Trees Read answer
Mid
How do you find the Lowest Common Ancestor in a BST vs binary tree?

Short answer: BST: walk from root — if both values are smaller go left, both larger go right, else current is LCA. General binary tree: recurse; if both sides return non-null, current is LCA; else return the non-null sid…

Trees Read answer
Mid
How do you find Top K Frequent Elements?

Short answer: Count frequencies with a hash map. Then either use a min-heap of size k (O(n log k)) or bucket sort by frequency (O(n)) since frequencies are in 1..n. Complexity Heap O(n log k); bucket O(n). Common follow-…

Heap / Bucket Sort Read answer
Mid
Explain Clone Graph.

Short answer: BFS/DFS while maintaining a map from original node → clone. For each neighbor, clone if missing, then link clones. Prevents infinite loops on cycles. Complexity Time O(V + E), Space O(V). The visited/clone…

Graphs Read answer
Mid
What is the Kth Largest Element approach in an interview?

Short answer: Min-heap of size k: O(n log k). Quickselect (partition) average O(n), worst O(n²). Sorting is O(n log n) — mention then improve. Common follow-ups Kth largest in a stream Find median If they care about wors…

Heap / Quickselect Read answer

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, C# 8 introduced private methods in interfaces.

Explain a bit more

Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string message) => LogInternal(message); private void LogInternal(string msg) => Console.WriteLine(msg); } Yes, C# 8 introduced private methods in interfaces. Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string message) => LogInternal(message); private void LogInternal(string msg) => Console.WriteLine(msg);

Real-world example (ShopNest)

ShopNest’s Order keeps _items private and exposes AddItem() so totals stay correct—callers cannot put a negative quantity directly into the list.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Abstract classes often define base contracts or template methods for patterns: Abstract Factory: Defines abstract methods to create families of objects. Strategy Pattern: Abstract class defines a common interface for interchangeable algorithms. abstract class PaymentStrategy {

Example code

public abstract void Pay(decimal amount);
}
class CreditCardPayment : PaymentStrategy
{
public override void Pay(decimal amount) => Console.WriteLine($"Paid {amount} by credit card"); }

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Encapsulation and abstraction hide implementation details, exposing only necessary interfaces. Polymorphism allows replaceable modules, facilitating microservices independently deployed and evolved. SOLID principles and interface-based contracts promote loose coupling and autonomous service design.

Real-world example (ShopNest)

Think of ShopNest’s Product, Cart, and Order classes: each object holds data + behavior, so pricing rules stay next to the data they use.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Arrays & DP

Short answer: Kadane’s algorithm: keep a running sum; if it goes negative, reset to 0 (or start fresh at the next element). Track the best running sum seen. This finds the contiguous subarray with maximum sum in O(n).

Problem statement

Given an integer array, find the contiguous subarray with the largest sum and return that sum.

Interview approach

  1. Mention divide-and-conquer O(n log n) if asked for alternatives.
  2. Explain local decision: extend current subarray or start new at i.
  3. Handle all-negative arrays carefully (max element, not 0).

Sample solution

C#
int MaxSubArray(int[] nums) {
    int best = nums[0], cur = nums[0];
    for (int i = 1; i < nums.Length; i++) {
        cur = Math.Max(nums[i], cur + nums[i]);
        best = Math.Max(best, cur);
    }
    return best;
}

Complexity

Time O(n), Space O(1).

Edge cases to mention

  • All negative numbers
  • Single element
  • Mix of positives and zeros

Common follow-ups

  • Also return the start/end indices
  • Circular maximum subarray
If the interviewer allows empty subarray, resetting to 0 is fine; otherwise use the version above.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Arrays & Prefix

Short answer: Build prefix products from the left and suffix products from the right. For index i, answer[i] = prefix[i] * suffix[i]. You can do it with one output array and one running suffix to achieve O(1) extra space (excluding output).

Interview approach

  1. Clarify: no division; O(n) time expected.
  2. First pass: answer[i] = product of all left of i.
  3. Second pass from right: multiply by running right product.

Sample solution

C#
int[] ProductExceptSelf(int[] nums) {
    int n = nums.Length;
    var ans = new int[n];
    ans[0] = 1;
    for (int i = 1; i < n; i++) ans[i] = ans[i - 1] * nums[i - 1];
    int right = 1;
    for (int i = n - 1; i >= 0; i--) {
        ans[i] *= right;
        right *= nums[i];
    }
    return ans;
}

Complexity

Time O(n), Space O(1) extra (output not counted).

Edge cases to mention

  • Zeros in the array (one zero vs two zeros)
  • Negatives
Never use division in the interview version — many panels explicitly forbid it.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Two Pointers

Short answer: Sort the array. Fix one number, then use two pointers on the remainder to find pairs that sum to −fixed. Skip duplicates carefully to return unique triplets. Overall O(n²).

Interview approach

  1. Sort ascending.
  2. For i from 0..n-3, skip duplicate nums[i].
  3. Left = i+1, right = n-1; move based on sum vs 0.
  4. When sum == 0, record triplet and skip duplicate left/right.

Complexity

Time O(n²), Space O(1) extra besides output (sorting may use O(log n)).

Edge cases to mention

  • Fewer than 3 elements
  • All zeros
  • Many duplicates

Common follow-ups

  • 4Sum
  • 3Sum Closest

Mistakes to avoid

  • Forgetting to skip duplicates → wrong unique set
  • Using the same index twice
Sorting + two pointers is the pattern interviewers expect after Two Sum.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Two Pointers

Short answer: Two pointers at both ends. Area = min(height[L], height[R]) * (R − L). Move the pointer at the shorter line inward, because width shrinks and only a taller line can improve area. O(n) time.

Complexity

Time O(n), Space O(1).

Edge cases to mention

  • Length 2
  • Strictly increasing heights

Common follow-ups

  • Trapping Rain Water (harder, needs prefix max or stack)
Prove the greedy move: the shorter side is the bottleneck.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Sliding Window

Short answer: Sliding window with a map/set of characters in the current window. Expand right; when a duplicate appears, shrink left until the window is unique again. Track max window length.

Sample solution

C#
int LengthOfLongestSubstring(string s) {
    var last = new Dictionary<char, int>();
    int left = 0, best = 0;
    for (int right = 0; right < s.Length; right++) {
        char c = s[right];
        if (last.TryGetValue(c, out int prev) && prev >= left)
            left = prev + 1;
        last[c] = right;
        best = Math.Max(best, right - left + 1);
    }
    return best;
}

Complexity

Time O(n), Space O(min(n, alphabet)).

Edge cases to mention

  • Empty string
  • All unique
  • All same character
  • Unicode / case sensitivity
Name the pattern “variable-size sliding window” — it signals seniority.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Trees

Short answer: Each node must lie within an allowed (low, high) range. Recurse left with high = node.val and right with low = node.val. Alternatively, inorder traversal must produce a strictly increasing sequence.

Complexity

Time O(n), Space O(h) recursion height.

Mistakes to avoid

  • Only comparing with immediate children (misses deeper violations)
  • Using ≤ when duplicates are not allowed
Pass long.MinValue/MaxValue (or nullable bounds) to avoid int overflow edge cases.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Graphs / Grid DFS

Short answer: Scan the grid. When you find a '1', increment island count and DFS/BFS to sink (mark visited) the entire connected land component. Count how many times you start a flood fill.

Complexity

Time O(rows * cols), Space O(rows * cols) worst-case recursion/queue.

Edge cases to mention

  • Empty grid
  • All water
  • Diagonal connectivity? (usually 4-directional only)

Common follow-ups

  • Max area of island
  • Number of distinct islands
  • Surrounded regions
Clarify 4-direction vs 8-direction before coding.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Graphs

Short answer: Model prerequisites as a directed graph. Detect a cycle with DFS colors (white/gray/black) or Kahn’s algorithm (BFS indegrees). If a cycle exists, you cannot finish all courses.

Complexity

Time O(V + E), Space O(V + E).

Common follow-ups

  • Course Schedule II — return a valid order (topological sort)
  • Parallel semester counting
Say “topological sort / cycle detection” early — that is the pattern name they want.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Dynamic Programming

Short answer: Unbounded knapsack DP: dp[a] = minimum coins to make amount a. For each coin, update dp[x] = min(dp[x], dp[x - coin] + 1). Initialize dp[0] = 0 and others to +∞. Return -1 if unreachable.

Complexity

Time O(amount * coins), Space O(amount).

Edge cases to mention

  • Amount 0 → 0
  • No combination possible → -1
  • Coin larger than amount

Common follow-ups

  • Coin Change II — number of combinations
  • Fewest coins with limited supply
Mention top-down memoization as an alternative to bottom-up.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Intervals

Short answer: Sort intervals by start. Scan and merge when the next start ≤ current end; otherwise push current and start a new one. O(n log n) from sorting.

Sample solution

C#
int[][] Merge(int[][] intervals) {
    Array.Sort(intervals, (a, b) => a[0].CompareTo(b[0]));
    var res = new List<int[]>();
    foreach (var iv in intervals) {
        if (res.Count == 0 || res[^1][1] < iv[0]) res.Add(iv);
        else res[^1][1] = Math.Max(res[^1][1], iv[1]);
    }
    return res.ToArray();
}

Complexity

Time O(n log n), Space O(n).

Common follow-ups

  • Insert Interval
  • Meeting Rooms II (min rooms / sweep line)
  • Employee Free Time
Sorting by start is non-negotiable — say it before coding.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Binary Search

Short answer: Modified binary search: check which half is sorted, then decide whether the target lies in that sorted half. Still O(log n).

Interview approach

  1. Compute mid.
  2. If left half sorted (nums[lo] ≤ nums[mid]): if target in [lo, mid) go left else right.
  3. Else right half sorted: if target in (mid, hi] go right else left.

Complexity

Time O(log n), Space O(1).

Edge cases to mention

  • No rotation
  • Duplicates (harder — may degrade to O(n))
  • Single element
Draw a rotated array and mark the sorted half each step while explaining.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Backtracking

Short answer: DFS from each cell matching the first letter. Mark visited, explore 4 directions for the next character, then unmark (backtrack). Return true as soon as the word is completed.

Complexity

Time roughly O(N * 4^L) worst case (N cells, L word length); Space O(L) recursion.

Edge cases to mention

  • Word longer than board cells
  • Reuse of same cell (forbidden)
  • Single-letter word
Emphasize marking/unmarking — that is the backtracking signature.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Tries

Short answer: Each node has children map/array[26] and an isEnd flag. insert/search/startsWith walk character by character. Tries shine for autocomplete and dictionary prefix queries.

Complexity

Time O(L) per operation (L = word length), Space O(total characters).

Common follow-ups

  • Word Search II (Trie + backtracking)
  • Replace Words
Ask if alphabet is lowercase English — array[26] is cleaner than Dictionary.
Permalink & share

Career Growth Career & HR Interview Guide · Career Growth

Short answer: A Tech Lead balances architecture quality, delivery predictability, and team growth. You need strong technical depth plus execution leadership under constraints. Show that you can make decisions, align stakeholders, and unblock others consistently.

Step-by-step approach

  1. Own a project involving multiple engineers and cross-functional dependencies.
  2. Lead design reviews and drive consensus on architecture choices.
  3. Establish delivery rituals like planning, risk tracking, and incident retrospectives.
  4. Coach teammates through code quality and estimation discipline.
  5. Improve stakeholder communication with transparent status and trade-off updates.
  6. Collect feedback from peers, product managers, and engineering managers.

Real-world example

Ananya at Infosys was a strong coder but had little leadership exposure. Vikram from Freshworks asked her to lead a migration project involving backend, QA, and DevOps teams. She introduced weekly risk tracking and clearer technical decision notes. The project shipped on time and her manager started positioning her as a tech lead candidate.

Mistakes to avoid

  • Trying to lead only through authority instead of influence.
  • Micromanaging implementation instead of delegating effectively.
  • Ignoring stakeholder communication while focusing only on code.
  • Avoiding difficult trade-off decisions.
Tech leads are measured by team outcomes, not personal output alone.
Permalink & share

Career Growth Career & HR Interview Guide · Career Growth

Short answer: Engineering Managers are accountable for team performance, people growth, and delivery health. This shift requires moving from individual output to systems of execution and coaching. You still need technical credibility, but your primary lever becomes people and process.

Step-by-step approach

  1. Start mentoring juniors and conducting structured 1:1s consistently.
  2. Own sprint planning quality, delivery forecasting, and dependency risk management.
  3. Improve hiring and onboarding outcomes for your team.
  4. Build conflict resolution and feedback skills through real team situations.
  5. Track team-level metrics like delivery predictability and incident frequency.
  6. Work with your manager on a transition plan from IC to EM responsibilities.

Real-world example

Meera at Freshworks was a senior IC and wanted to move into engineering management. Rohit from CRED suggested she begin by mentoring two engineers and owning sprint health metrics. She improved planning accuracy and reduced release chaos over two quarters. Leadership recognized her readiness and moved her into an EM-track role.

Mistakes to avoid

  • Holding onto all coding tasks and avoiding delegation.
  • Managing work without managing people growth.
  • Skipping difficult feedback conversations.
  • Measuring success only by sprint closure count.
EM growth starts when team success becomes your main KPI.
Permalink & share

Career Growth Career & HR Interview Guide · Career Growth

Short answer: Career communication improves through structured thinking, concise speaking, and intentional listening. Strong communicators reduce confusion, unblock teams faster, and build trust across levels. Treat communication as a skill to practice weekly, not a personality trait.

Step-by-step approach

  1. Use a simple structure in updates: context, progress, risk, and next action.
  2. Practice concise speaking by summarizing complex topics in under 60 seconds.
  3. Improve listening by repeating key points before responding.
  4. Write clear meeting notes and action owners after major discussions.
  5. Seek feedback on clarity from peers and managers regularly.
  6. Record mock presentations and remove filler words progressively.

Real-world example

Neha at CRED was technically strong but struggled to communicate updates to leadership. Arjun from Flipkart coached her to use a fixed status format with risks and decisions highlighted. She also practiced concise demos before stakeholder meetings. Her communication confidence improved and she was included in more cross-team discussions.

Mistakes to avoid

  • Explaining details without first clarifying objective.
  • Speaking too much and losing key message.
  • Avoiding difficult conversations until issues escalate.
  • Not documenting decisions and owners after meetings.
Clarity is the fastest path to influence.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Linked Lists

Short answer: Two pointers with a gap of n. Advance fast n steps, then move both until fast hits the end; slow.next is the node to delete. One pass, O(1) space.

Edge cases to mention

  • Remove head (n == length)
  • Single node list
  • n = 1 (remove tail)
Use a dummy head so deleting the real head is uniform.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Trees

Short answer: BFS with a queue. Process level size at a time, enqueue children, and collect values per level into a list of lists.

Complexity

Time O(n), Space O(n) for the queue/result.

Common follow-ups

  • Zigzag level order
  • Average of levels
  • Right side view
Capturing level size before the inner loop is the key detail interviewers watch for.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Trees

Short answer: BST: walk from root — if both values are smaller go left, both larger go right, else current is LCA. General binary tree: recurse; if both sides return non-null, current is LCA; else return the non-null side.

Complexity

BST average O(h); general tree O(n).

Ask which tree type — the optimal approach changes.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Heap / Bucket Sort

Short answer: Count frequencies with a hash map. Then either use a min-heap of size k (O(n log k)) or bucket sort by frequency (O(n)) since frequencies are in 1..n.

Complexity

Heap O(n log k); bucket O(n).

Common follow-ups

  • Top K frequent words (tie-break lexicographically)
  • Kth largest element
Prefer bucket sort when you want to show O(n) mastery.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Graphs

Short answer: BFS/DFS while maintaining a map from original node → clone. For each neighbor, clone if missing, then link clones. Prevents infinite loops on cycles.

Complexity

Time O(V + E), Space O(V).

The visited/clone map is mandatory — say it before writing loops.
Permalink & share

DSA & Coding Interviews Coding Interview FAQ · Heap / Quickselect

Short answer: Min-heap of size k: O(n log k). Quickselect (partition) average O(n), worst O(n²). Sorting is O(n log n) — mention then improve.

Common follow-ups

  • Kth largest in a stream
  • Find median
If they care about worst-case, discuss heap; if average-case, mention Quickselect.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details