Skip to main content

Coursera Coding Interview Questions

25 Coursera coding interview problems with full optimal solutions — 15 easy, 7 medium, 3 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Coursera interviewer values, and a FAQ section.

  • #1easyfoundational

    1. Two Sum

    Find two indices whose values sum to a target — Coursera uses this to gauge hash-table fluency in a learner-pairing context.

  • #2easyfoundational

    2. Valid Parentheses

    Validate that a string of brackets is well-formed — Coursera uses this to test stack discipline in a course-syntax-checker context.

  • #3easyfoundational

    3. Merge Two Sorted Lists

    Merge two sorted linked lists into one — Coursera uses this to test pointer hygiene in a sorted-content-streams setting.

  • #5easyfoundational

    5. Remove Element

    Remove all instances of a value in-place — Coursera uses this to test two-pointer fluency for filtering enrollment lists.

  • #6easyfoundational

    6. Search Insert Position

    Find the insert index in a sorted array — Coursera tests binary-search invariants for ordered course-catalog inserts.

  • #7easyfoundational

    7. Maximum Subarray

    Find the contiguous subarray with the largest sum — Coursera uses this to test Kadane in a learner-engagement streak setting.

  • #8easyfoundational

    8. Plus One

    Increment a digit array by one — Coursera uses this to test carry-propagation cleanliness for grade-encoded counters.

  • #9easyfoundational

    9. Merge Sorted Array

    Merge two sorted arrays in-place — Coursera tests back-fill two-pointer technique for in-place enrollment merges.

  • #11easyfoundational

    11. Same Tree

    Decide if two binary trees are structurally identical — Coursera tests recursive structural compare for course-tree diffing.

  • #12easyfoundational

    12. Maximum Depth of Binary Tree

    Find the maximum depth of a binary tree, a foundational tree-traversal problem Coursera uses to test recursive thinking for hierarchical course-content structures.

  • #13easyfoundational

    13. Balanced Binary Tree

    Determine whether a binary tree is height-balanced, a tree-depth problem Coursera uses to gauge clean recursive design.

  • #14easyfoundational

    14. Path Sum

    Check whether a root-to-leaf path summing to a target exists, a DFS problem Coursera uses to test tree traversal for prerequisite-chain checks.

  • #15easyfoundational

    15. Pascal's Triangle

    Generate the first numRows of Pascal's triangle, an iterative DP warm-up Coursera uses to test basic 2-D array construction.

  • #16mediumfoundational

    16. Add Two Numbers

    Add two numbers represented as reversed linked lists, a carry-propagation problem Coursera uses to test pointer manipulation and edge-case handling.

  • #18mediumfoundational

    18. Coin Change

    Find the fewest coins that sum to a target amount, a bottom-up DP problem Coursera uses to assess dynamic programming skills relevant to course-scheduling optimization.

  • #19mediumfoundational

    19. Number of Islands

    Count connected components of land cells in a grid, a BFS/DFS graph problem Coursera uses to evaluate traversal skills relevant to course dependency graph analysis.

  • #20mediumfoundational

    20. Course Schedule

    Detect if a cycle exists in a directed course-prerequisite graph, a topological sort problem with direct real-world relevance to Coursera's own curriculum dependency engine.

  • #21mediumfoundational

    21. Word Break

    Determine if a string can be segmented into dictionary words, a DP problem Coursera uses to assess text-processing skills relevant to content tagging and search.

  • #22mediumfoundational

    22. LRU Cache

    Design and implement an LRU cache with O(1) get and put, a data-structure design problem Coursera uses to evaluate caching knowledge relevant to content delivery optimization.

  • #23hardfoundational

    23. Median of Two Sorted Arrays

    Find the median of two sorted arrays in O(log(m+n)) time, a binary search hard problem Coursera uses to test candidates' ability to reason about partitioning for analytics pipelines.

  • #24hardfoundational

    24. Trapping Rain Water

    Compute how much rainwater can be trapped between elevation bars, a two-pointer hard problem Coursera asks to gauge O(n) space-optimized reasoning.

  • #25hardfoundational

    25. Serialize and Deserialize Binary Tree

    Design an algorithm to serialize and deserialize a binary tree, a systems-design coding problem Coursera uses to test encoding/decoding logic relevant to course content persistence.

Coursera Coding Interview Questions — Full Solutions — InterviewChamp.AI