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 18 problems of 25

  • #3easysometimes asked

    3. Merge Two Sorted Lists

    Merge two sorted linked lists into one sorted list. Palantir asks this to gauge pointer hygiene since their ETL transforms frequently merge sorted streams of records by primary key.

  • #4easysometimes asked

    4. Remove Duplicates from Sorted Array

    In-place de-duplicate a sorted array and return the new length. Palantir asks this to test the two-pointer pattern, which is the foundation of any de-dup pass over a sorted entity-resolution candidate stream.

  • #5easyrarely asked

    5. Remove Element

    Remove all occurrences of a value from an array in-place and return the new length. Palantir asks this to test the same two-pointer pattern used in filter-stage transforms of their Foundry data pipelines.

  • #6easysometimes asked

    6. Search Insert Position

    Find the index where a target should be inserted in a sorted array. Palantir uses this as a binary-search litmus test before harder lower-bound problems on time-series telemetry indices.

  • #7easysometimes asked

    7. Maximum Subarray

    Find the contiguous subarray with the largest sum. Palantir asks this because Kadane's algorithm illustrates the running-state pattern they expect in streaming aggregations over time-series telemetry.

  • #8easyrarely asked

    8. Plus One

    Increment a number represented as an array of digits. Palantir asks this to gauge attention to carry propagation, which mirrors how their telemetry counters roll over.

  • #9easysometimes asked

    9. Merge Sorted Array

    Merge two sorted arrays in-place where the first has extra space at the end. Palantir asks this to test the right-to-left two-pointer trick, which prevents overwriting unread data — a pattern they use in in-place ETL compaction.

  • #10easysometimes asked

    10. Binary Tree Inorder Traversal

    Return the inorder traversal of a binary tree's values. Palantir asks this to test whether you can write iterative tree traversal — a primitive for walking ontology graphs without stack overflow on deep hierarchies.

  • #11easysometimes asked

    11. Same Tree

    Given the roots of two binary trees p and q, write a function to check if they are the same. Palantir asks this to verify that you reason about tree equality recursively the same way they compare two versions of an ontology snapshot during a Foundry branch merge.

  • #12easysometimes asked

    12. Maximum Depth of Binary Tree

    Given the root of a binary tree, return its maximum depth. Palantir uses this to gauge whether you treat tree depth as a recursive max problem — the same primitive they use to compute the longest dependency chain in an ETL DAG before deciding scheduler timeouts.

  • #14easysometimes asked

    14. Single Number

    Given a non-empty array of integers where every element appears twice except for one, find that single one. Palantir asks this to see if you reach for XOR — a constant-space trick they value when streaming dedup logic runs on row-level entity resolution in Foundry.

  • #15easysometimes asked

    15. Majority Element

    Given an array of size n, return the element that appears more than n/2 times. Palantir asks this to test whether you know Boyer-Moore voting — an O(1)-space streaming primitive they care about because it generalizes to finding the dominant entity ID across a sharded dataset without a shuffle.

  • #19mediumsometimes asked

    19. Kth Largest Element in an Array

    Find the kth largest element in an unsorted array. Palantir asks this to test whether you reach for a min-heap of size k — the same streaming primitive their dashboards use to compute top-k entities by row count without scanning the whole dataset twice.

  • #21mediumsometimes asked

    21. Longest Increasing Subsequence

    Given an integer array nums, return the length of the longest strictly increasing subsequence. Palantir asks this to see whether you know the O(n log n) patience-sort trick — they care because the same algorithm powers monotone trend extraction over a sorted-by-time partition in a Foundry transform.

  • #22mediumsometimes asked

    22. Critical Connections in a Network

    Find all critical edges (bridges) in an undirected network whose removal disconnects it. Palantir asks this because their ontology team uses Tarjan's bridge algorithm to flag dependency edges in an ETL DAG whose removal would silo a downstream pipeline — bridges are blast-radius signals.

  • #23hardsometimes asked

    23. Binary Tree Maximum Path Sum

    A path in a binary tree is any sequence of nodes connected by edges; return the maximum sum across all such paths. Palantir asks this to see whether you separate the value RETURNED from a recursive call from the value RECORDED at each node — the same split they use when computing aggregated weights along ontology paths under row-level ACL.

  • #24hardsometimes asked

    24. Alien Dictionary

    Given a list of words sorted lexicographically by an alien language, derive the character order. Palantir asks this because it's the textbook example of inferring a partial order from observed pairs — exactly what their ontology system does when reconciling type hierarchies from disparate source systems during entity resolution.

  • #25hardrarely asked

    25. Longest Cycle in a Graph

    Given a directed graph where each node has at most one outgoing edge, return the length of the longest cycle. Palantir asks this because their ontology validator must detect cycles in foreign-key constraints — and when each entity points to exactly one parent, the cycle search shape is precisely this problem.

Palantir Coding Interview Questions — Full Solutions — InterviewChamp.AI