Palantir Technology Interview Questions
- 1of 1 vote
AnswersGiven an integer n, replace its bits starting from the bit at position a to the bit at position b, inclusive, with the bits of integer k. Count from the least significant bit to the most significant bit, starting from 0.
- btmakusha February 19, 2018 in United States
Example:
For n = 1024, a = 1, b = 6 and k = 17, the output should be
insertBits(n, a, b, k) = 1058.
n = 100 0000 00002, k = 1 00012, 1058 = 100 0010 00102.
For n = 11, a = 1, b = 2 and k = 2, the output should be
insertBits(n, a, b, k) = 13.
n = 10112, k = 102, 13 = 11012.| Report Duplicate | Flag | PURGE
Palantir Technology Software Engineer - 1of 1 vote
Answers## This is the text editor interface.
- wonderkid September 02, 2017 in United States
## Anything you type or change here will be seen by the other person in real time.
# Implement the function that takes a board string
# and decodes it into the representative 2D array.
#
# |_|_|_|_|_|_|_|
# |_|_|r|_|_|_|_|
# |b|r|b|r|b|r|_|
# |b|b|b|r|r|b|_|
# |b|r|r|b|b|r|_|
# |r|b|b|r|r|r|b|
# CFN: 9_r4_brbrbr_3b2rb_b2r2br_r2b3rb
#
# This function should return a list of lists of strings.
# (i.e. a string[6][7]). The strings should be one of:
# * 'r' to indicate a red piece
# * 'b' to indicate a black piece
# * '_' to indicate an empty space
#
# The input string is not necessarily a valid
# CFN board string. It is guaranteed not-empty.| Report Duplicate | Flag | PURGE
Palantir Technology Software Engineer Python - 1of 1 vote
AnswersImplement a simple, persistent, thread-safe, cache, which should ideally be able to store up to 1 million product names.
- sunilkanaujia.manit July 06, 2015 in India| Report Duplicate | Flag | PURGE
Palantir Technology SDE1 - 2of 2 votes
AnswersCrypt Analysis problem :
- akii March 03, 2015 in United States
The Interviewer told me to implement the following interface
interface Expression {
Set<Char> getChars();
boolean eval(Map<Char, Int> m);
}
Map will contain values like
{ 'O' => 2, 'N' => 3, 'E' => 1, ... 'T' => 4 , } :
And eval function evaluates if the answer is correct or not , input will have 3 strings operand1 , operand2 and answer .
Overall the question was not complete , so I asked him again and again that I just have to verify the answer and not calculate it .
Verifying was really easy just get the values from map and convert to int . Add them and verify if the answer is correct.
Cam someone tell if my assumption is correct about the problem .
Example:
ONE
+ONE
----
TWO
231
+231
----
462
FOUR
+FOUR
-----
EIGHT
5239
+5239
-----
10478| Report Duplicate | Flag | PURGE
Palantir Technology Software Engineer Algorithm - 1of 3 votes
AnswersC={1,2,2,3,4,5}
- fgfsdgs November 09, 2013 in United States
Sum=5
subset;
{1,2,2}
{1,4}
{2,3}
using exhaustive force in java
ideas| Report Duplicate | Flag | PURGE
Palantir Technology iOS Developer Java - 1of 1 vote
AnswersSort the letters in one word by the order they occur in another in linear time
- cyprusad July 22, 2013 in United States| Report Duplicate | Flag | PURGE
Palantir Technology Software Engineer / Developer Algorithm - 2of 2 votes
AnswersGiven an array of values, design and code an algorithm that returns whether there are two duplicates within k indices of each other? k indices and within plus or minus l (value) of each other? Do all, even the latter, in O(n) running time and O(k) space.
- fbrubacher May 19, 2013 in United States for Engineer| Report Duplicate | Flag | PURGE
Palantir Technology Software Engineer / Developer Algorithm - 1of 1 vote
AnswersExplain how you would implement a multi-map in Java without using any collections?
- fbrubacher May 17, 2013 in United States| Report Duplicate | Flag | PURGE
Palantir Technology Senior Software Development Engineer Java - 1of 5 votes
AnswersBelow question was asked in online coding exam for Palantir Technology, Palo Alto, CA. Time given was 100 min. I could not complete it by the time.
- Nitin Gupta February 02, 2013 in United States
-----------------------------
A group of farmers has some elevation data, and we’re going to help them understand how rainfall flows over their farmland.
We’ll represent the land as a two-dimensional array of altitudes and use the following model, based on the idea that water flows downhill:
If a cell’s four neighboring cells all have higher altitudes, we call this cell a sink; water collects in sinks.
Otherwise, water will flow to the neighboring cell with the lowest altitude. If a cell is not a sink, you may assume it has a unique lowest neighbor and that this neighbor will be lower than the cell.
Cells that drain into the same sink – directly or indirectly – are said to be part of the same basin.
Your challenge is to partition the map into basins. In particular, given a map of elevations, your code should partition the map into basins and output the sizes of the basins, in descending order.
Assume the elevation maps are square. Input will begin with a line with one integer, S, the height (and width) of the map. The next S lines will each contain a row of the map, each with S integers – the elevations of the S cells in the row. Some farmers have small land plots such as the examples below, while some have larger plots. However, in no case will a farmer have a plot of land larger than S = 5000.
Your code should output a space-separated list of the basin sizes, in descending order. (Trailing spaces are ignored.)
While correctness and performance are the most important parts of this problem, a human will be reading your solution, so please make an effort to submit clean, readable code. In particular, do not write code as if you were solving a problem for a competition.
A few examples are below.
Input:
3
1 5 2
2 4 7
3 6 9
Output:
7 2
The basins, labeled with A’s and B’s, are:
A A B
A A B
A A A
Input:
1
10
Output:
1
There is only one basin in this case.
Input:
5
1 0 2 5 8
2 3 4 7 9
3 5 7 8 9
1 2 5 4 2
3 3 5 2 1
Output:
11 7 7
The basins, labeled with A’s, B’s, and C’s, are:
A A A A A
A A A A A
B B A C C
B B B C C
B B C C C
Input:
4
0 2 1 3
2 1 0 4
3 3 3 3
5 5 2 1
Output:
7 5 4
The basins, labeled with A’s, B’s, and C’s, are:
A A B B
A B B B
A B B C
A C C C| Report Duplicate | Flag | PURGE
Palantir Technology Front-end Software Engineer Algorithm