Palantir interview experience Real time questions & tips from candidates to crack your interview

Software Engineer

Palantir
upvote
share-icon
2 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Graphs, DP, Time complexity, OOPS, Trees, Stacks, Queue
Tip
Tip

Tip 1 : Practice DSA questions as much as u can
Tip 2 : Focus on Graphs and Dynamic Programming more
Tip 3 : Make good Resume

Application process
Where: Linkedin
Eligibility: N/A
Resume Tip
Resume tip

Tip 1 : Single Page Resume
Tip 2 : Add your previous Experiences and good projects.

Interview rounds

01
Round
Easy
Online Coding Test
Duration90 minutes
Interview date10 Aug 2022
Coding problem2

The round was conducted on hackerrank, we were given 3 coding questions and 90 minutes to solve the questions were on the tougher side.All questions were based on graphs and tries.Also all 3 questions were inter Related.I hardly remember the last one so i mentioned 2 of them here.

1. LRU Cache Implementation

Moderate
25m average time
65% success
0/80
Asked in companies
OYOHikeWalmart

Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:

1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.

2. put(key, value), Insert the value in the cache if the key is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
You will be given ‘Q’ queries. Each query will belong to one of these two types:
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
Note :
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).

2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.
Try solving now

2. Topological Sort

Moderate
30m average time
70% success
0/80
Asked in companies
MicrosoftSamsungSprinklr

A Directed Acyclic Graph (DAG) is a directed graph that contains no cycles.

Topological Sorting of DAG is a linear ordering of vertices such that for every directed edge from vertex ‘u’ to vertex ‘v’, vertex ‘u’ comes before ‘v’ in the ordering. Topological Sorting for a graph is not possible if the graph is not a DAG.

Given a DAG consisting of ‘V’ vertices and ‘E’ edges, you need to find out any topological sorting of this DAG. Return an array of size ‘V’ representing the topological sort of the vertices of the given DAG.

For example, Consider the DAG shown in the picture.

alt tex

In this graph, there are directed edges from 0 to 1 and 0 to 3, so 0 should come before 1 and 3. Also, there are directed edges from 1 to 2 and 3 to 2 so 1 and 3 should come before 2.

So, The topological sorting of this DAG is {0 1 3 2}.

Note that there are multiple topological sortings possible for a DAG. For the graph given above one another topological sorting is: {0, 3, 1, 2}

Note:
1. It is guaranteed that the given graph is DAG.
2. There will be no multiple edges and self-loops in the given DAG.
3. There can be multiple correct solutions, you can find any one of them. 
4. Don’t print anything, just return an array representing the topological sort of the vertices of the given DAG.
Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date12 Oct 2022
Coding problem6

In this round first 5 mins went into an introduction and the interviewer explaining me about the interview process.
Then I was given 15 mins to solve 3-time complexity questions, after it, next 40 mins the interviewer told me that try to solve as many questions as possible, the focus more on the correctness of the solution rather than the optimal solution.

1. Puzzle Question

A code was given, which was essentially counting the sum of the digits of the number.
We need to tell the time complexity for it.

Problem approach

Tip 1 : the complexity should be O(no of digits) which is essentially logn
 

2. Puzzle Question

Let's assume there are two functions one whose complexity was (N + M) and the other whose complexity was N*logM we need to tell which has lower complexity and also in what scenarios the function having lower complexity will take more time.

Problem approach

Tip 1 : Need to have a good knowledge of Asymptotic notations and time complexity.

3. Puzzle Question

Given a file having n lines and every line has a different number of characters written, if we want to find the middle line can we calculate the sum of bytes of all characters in the file and divide it by n ? will that position will always be somewhere in the middle line ???

Problem approach

Tip 1 : The answer would be no because it might happen some lines have a huge number of characters and some lines have very few characters so the average would not always result somewhere in the middle line.

4. Rotting Oranges

Moderate
30m average time
85% success
0/80
Asked in companies
AmazonSoroco
You are given an integer grid of size ‘N’x’M’, and the cell of the grid contains either of the three values:

  • 0 - An empty cell.
  • 1 - A fresh orange.
  • 2 - A rotten orange.
  • Every minute, any fresh orange adjacent(4-directionally) to a rotten orange becomes rotten.

    You must return the minimum time after which no fresh oranges are left. Return -1 if it's impossible to rot all the fresh oranges.

    Example:
    Input: [[2,1,1],[1,1,0],[0,0,0]]
    
    Output: 2
    
    At T=0, only orange at (0,0) is rotten.
    At T=1, oranges at (0,0),(0,1) and (1,0) are rotten.
    At T=2, oranges at (0,0),(0,1),(1,0),(0,2) and (1,1) are rotten. 
    No fresh oranges are left after T=2.
    
    Problem approach

    solved using BFS

    Try solving now

    5. Contain Virus

    Hard
    45m average time
    55% success
    0/120
    Asked in companies
    AppleMeeshoMercer Mettl

    You have been given a 2D model of a country, with the help of a matrix containing 0 and 1. The 0’s in the model represent uninfected cells and 1’s represent the cells contaminated by a deadly spreading virus. Only a single wall can be built between any two cells of the model that are adjacent in all four directions, on their shared boundary.

    With every passing night, the virus spreads to all the adjacent cells, unless the cells are blocked by a wall. You need to build walls in order to stop the virus from spreading in the whole country. Note that you can only install walls around only one region which is the affected area that threatens to infect the most uninfected cells of the matrix in one day.

    Given the state of each cell, your task is to find the number of walls you used to stop as many cells as possible from being infected.

    Problem approach

    solved using DFS

    Try solving now

    6. Shortest Path in a Binary Matrix

    Moderate
    37m average time
    65% success
    0/80
    Asked in companies
    SamsungOracleAmazon

    You have been given a binary matrix of size 'N' * 'M' where each element is either 0 or 1. You are also given a source and a destination cell, both of them lie within the matrix.

    Your task is to find the length of the shortest path from the source cell to the destination cell only consisting of 1s. If there is no path from source to destination cell, return -1.

    Note:
    1. Coordinates of the cells are given in 0-based indexing.
    2. You can move in 4 directions (Up, Down, Left, Right) from a cell.
    3. The length of the path is the number of 1s lying in the path.
    4. The source cell is always filled with 1.
    
    For example -
    1 0 1
    1 1 1
    1 1 1
    For the given binary matrix and source cell(0,0) and destination cell(0,2). Few valid paths consisting of only 1s are
    
    X 0 X     X 0 X 
    X X X     X 1 X 
    1 1 1     X X X 
    The length of the shortest path is 5.
    
    Problem approach

    Since this was the third question interviewer was not expecting me to code the solution, he just wanted me to explain my solution by dry running it on test cases.
    My solution was based on BFS.

    Try solving now

    Here's your problem of the day

    Solving this problem will increase your chance to get selected in this company

    Skill covered: Programming

    What is recursion?

    Choose another skill to practice
    Similar interview experiences
    company logo
    SDE - 1
    3 rounds | 7 problems
    Interviewed by OYO
    4657 views
    0 comments
    0 upvotes
    company logo
    SDE - Intern
    2 rounds | 3 problems
    Interviewed by Amazon
    961 views
    0 comments
    0 upvotes
    company logo
    SDE - 1
    2 rounds | 5 problems
    Interviewed by Meesho
    6451 views
    0 comments
    0 upvotes
    company logo
    SDE - 1
    3 rounds | 9 problems
    Interviewed by Salesforce
    3452 views
    0 comments
    0 upvotes
    Companies with similar interview experiences
    company logo
    Software Engineer
    3 rounds | 7 problems
    Interviewed by Optum
    7874 views
    1 comments
    0 upvotes
    company logo
    Software Engineer
    5 rounds | 5 problems
    Interviewed by Microsoft
    9973 views
    1 comments
    0 upvotes
    company logo
    Software Engineer
    2 rounds | 4 problems
    Interviewed by Amazon
    4310 views
    1 comments
    0 upvotes