Skip to main content

Palantir Coding Interview Questions

25 Palantir 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 Palantir interviewer values, and a FAQ section.

Showing 7 problems of 25

  • #1easyfrequently asked

    1. Two Sum

    Given an array of integers and a target, return indices of the two numbers that sum to target. Palantir asks this early as a warm-up to gauge whether you reach for hash-map lookups immediately or default to nested loops, since their ETL pipelines join entities by key constantly.

  • #2easyfrequently asked

    2. Valid Parentheses

    Determine if a string of brackets is balanced and properly nested. Palantir uses this to probe whether you reach for a stack immediately, since their Foundry expression parser and ontology query language need balanced delimiter validation.

  • #13easyfrequently asked

    13. Best Time to Buy and Sell Stock

    Given an array prices where prices[i] is the price of a given stock on day i, find the maximum profit from a single buy/sell. Palantir uses this to test whether you spot the running-min-then-diff streaming pattern they apply to anomaly detection across time-series rows in a Foundry dataset.

  • #16mediumfrequently asked

    16. Number of Islands

    Given a 2D grid of '1's (land) and '0's (water), count the number of islands. Palantir asks this to verify you write iterative flood-fill cleanly — the same connected-components primitive their entity-resolution pipelines use to cluster duplicate records into a single canonical entity in the ontology.

  • #17mediumfrequently asked

    17. Course Schedule

    Given n courses with prerequisite pairs, determine if you can finish all courses. Palantir asks this because it's literally the same cycle-detection check their Foundry build engine runs before scheduling an ETL DAG — any cycle and the pipeline rejects the build.

  • #18mediumfrequently asked

    18. Course Schedule II

    Return the order in which you should take courses to finish them all; if impossible, return []. Palantir asks this as the natural follow-up to cycle detection — the actual execution order is what their Foundry scheduler emits when it serializes an ETL DAG into a runnable task list.

  • #20mediumfrequently asked

    20. Lowest Common Ancestor of a Binary Tree

    Given a binary tree, find the lowest common ancestor of two given nodes. Palantir asks this because it's the kernel of their ontology permission resolver — to determine the closest shared parent of two entities so row-level ACL checks can short-circuit at the right scope.

Palantir Coding Interview Questions — Full Solutions — InterviewChamp.AI