Skip to main content

GitHub Coding Interview Questions

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

  • #1easyfoundational

    1. Two Sum

    Find indices of two numbers in an array that sum to a target — GitHub uses this to gauge hash-map intuition before diving into Git ref lookup problems.

  • #2easyfoundational

    2. Valid Parentheses

    Determine if a string of brackets is balanced — GitHub uses this as a warm-up before diving into nested merge conflict markers and diff hunk delimiters.

  • #3easyfoundational

    3. Merge Two Sorted Lists

    Merge two sorted linked lists into one sorted list — GitHub treats this as the toy version of merging two sorted commit-date streams during git log --merge.

  • #5easyfoundational

    5. Remove Element

    Remove all occurrences of a value from an array in-place — GitHub's lead-in to pruning broken refs from a packed-refs file without reallocating.

  • #6easyfoundational

    6. Search Insert Position

    Return the index at which a target would be inserted in a sorted array — GitHub's warm-up for the binary search inside the pack-index .idx fan-out table.

  • #7easyfoundational

    7. Maximum Subarray

    Find the contiguous subarray with the largest sum — GitHub uses this Kadane warmup before stepping into hunk-coalescing scoring in their diff renderer.

  • #8easyfoundational

    8. Plus One

    Increment a number represented as a digit array by one — GitHub's tiny entry to BigInt carry handling, mirroring the version-counter bump in tag-name auto-increment scripts.

  • #9easyfoundational

    9. Merge Sorted Array

    Merge two sorted integer arrays in place into nums1 — GitHub's setup for the three-way merge core: writing from the back to avoid clobbering unread input.

  • #10easyfoundational

    10. Binary Tree Inorder Traversal

    Return the inorder traversal of a binary tree's node values — GitHub's lead-in to traversing the parent-DAG of a commit history in chronological order.

  • #11easyfoundational

    11. Same Tree

    Determine if two binary trees are identical — GitHub's stand-in for SHA-equality checks across two commit subtrees in a fast-forward verification.

  • #12mediumfoundational

    12. Number of Islands

    BFS/DFS grid traversal that mirrors how GitHub models repository dependency graphs and connected component analysis.

  • #13mediumfoundational

    13. Clone Graph

    Deep-clone a connected undirected graph using BFS/DFS, directly analogous to forking a repository and cloning its entire commit DAG.

  • #14mediumfoundational

    14. Course Schedule

    Topological sort / cycle detection on a directed graph, directly modeling how GitHub Actions resolves job dependencies and detects circular workflow references.

  • #16mediumfoundational

    16. Pacific Atlantic Water Flow

    Multi-source BFS/DFS on a grid to find cells reachable from both boundaries, testing bidirectional graph traversal skills GitHub values for diff and merge reachability.

  • #17mediumfoundational

    17. Implement Trie (Prefix Tree)

    Build a trie supporting insert, search, and startsWith — the data structure behind GitHub's code search autocomplete and repository name prefix matching.

  • #18mediumfoundational

    18. Word Search

    Backtracking DFS on a grid to find a word path, testing the same traversal and backtracking patterns used in code-search substring matching across file content.

  • #19mediumfoundational

    19. Find All Anagrams in a String

    Sliding window with character frequency maps to find all anagram start indices — a pattern used in GitHub's fuzzy file-name and diff-string search.

  • #20hardfoundational

    20. Minimum Window Substring

    Variable sliding window to find the smallest substring containing all target characters — the canonical string-processing hard problem GitHub tests in senior-level loops.

  • #22easyfoundational

    22. Symmetric Tree

    Check whether a binary tree is a mirror of itself using recursive or iterative paired traversal, a BFS/DFS tree skill GitHub tests in screening rounds.

  • #23mediumfoundational

    23. LRU Cache

    Design an O(1) get/put LRU cache using a doubly-linked list plus hashmap — the exact caching strategy used in GitHub's object store and pack-file cache layers.

  • #24hardfoundational

    24. Merge K Sorted Lists

    Merge k sorted linked lists into one sorted list using a min-heap, analogous to how GitHub merges multiple sorted commit streams from different remotes during a fetch.

  • #25mediumfoundational

    25. Max Area of Island

    Find the largest connected component in a binary grid using DFS — the same connected-components analysis used when GitHub calculates the largest contiguous change region in a pull request diff.

  • #26hardfoundational

    26. Trapping Rain Water

    Compute water trapped between bars using two-pointer or stack techniques — a classic hard problem GitHub includes in senior engineer interviews to test array reasoning under constraints.

Related interview-prep guides

Interview Platforms

Microsoft Teams Tech Interview Guide (2026): What to Expect

Microsoft Teams is the default interview surface at any company running Office 365: Fortune 500, finance, healthcare, government tech, legacy enterprise. Many enterprise interviewers record and transcribe the call into the company's OneDrive, which changes how you should prepare versus Zoom. This is the candidate-side guide to running a Teams interview in 2026.

GitHub Coding Interview Questions — Full Solutions — InterviewChamp.AI