FastPrepEncrypt Text by Columnar Transposition
Problems/Encrypt Text by Columnar Transposition

Encrypt Text by Columnar Transposition

Palantir logoPalantir● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Palantir phone screen. The report is about encrypting text with a column transposition cipher. It gives no layout, key, or test data. We chose these: write the text row by row, read it column by column, add no padding, and keep every character. We also chose the function interface and limits for plain ASCII. All examples are ours. Our version is about 60% the same as the reported question.

For this exercise, use the following columnar transposition rule. Write the characters of text from left to right into rows with columns positions each. The last row may be incomplete. Read the occupied cells column by column, from the leftmost column to the rightmost, and within each column from top to bottom. Return the resulting ciphertext.

For this exercise, assume no padding is added. Preserve every input character, including spaces, punctuation, digits and letter case. Skip unoccupied cells and return an empty string for empty text.

Function

encryptTransposition(text: String, columns: int) → String

Examples

Example 1

text = "WEAREDISCOVERED"columns = 4return = "WECREDOEAIVDRSE"

The columns contain WECR, EDOE, AIVD and RSE, read in that order.

Example 2

text = "abcde"columns = 3return = "adbec"

Rows are abc and de. Read ad, be and c without adding padding.

Constraints

  • For this exercise, assume 0 <= text.length <= 500 and 1 <= columns <= 500.
  • For this exercise, assume every input character is printable ASCII, from character code 32 through 126.

More Palantir interview questions

  • Balanced Session ManagerPHONE SCREEN · Seen Nov 2026
  • Query Words Within K PositionsPHONE SCREEN · Seen Nov 2026
  • Employees With Shared InterestsPHONE SCREEN · Seen Jul 2025
  • Merge a 2048 RowPHONE SCREEN · Seen Jan 2025
  • Encrypt Letters by First-Occurrence SubstitutionPHONE SCREEN · Seen Aug 2022
  • Basic Item DiscountsOA · Seen Nov 2026
  • Optimize Discount Selection Under a Point BudgetOA · Seen Nov 2026
  • Stacked Item and Category DiscountsOA · Seen Nov 2026
  • Map and Accumulate Learning QueriesONSITE INTERVIEW · Seen Oct 2026
  • Relational Learning QueriesONSITE INTERVIEW · Seen Apr 2025

Similar questions at other companies

  • Ordered IP FirewallDatabricks · PHONE SCREENDatabricks interview questions
  • Rank Word-Translation Hints from Sentence TranslationsDuolingo · PHONE SCREEN · ONSITE INTERVIEWDuolingo interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Largest Number Below N from Reusable DigitsByteDance · PHONE SCREENByteDance interview questions
  • Merge Weekday and Time IntervalsNextdoor · PHONE SCREENNextdoor interview questions
  • Group AnagramsWorkday · PHONE SCREEN
  • Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
  • Elevator Scheduling SimulationOpenAI · PHONE SCREENOpenAI interview questions
  • Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW

Palantir interview experiences

  • Palantir SWE New Grad - Gotham
  • Palantir FDSE Experienced-Hire Interviews: 5 Experiences
  • Palantir FDSE New Grad OA Questions: 6 Experiences (Part 2 of 2)
  • Palantir FDSE New Grad Interviews: 5 Experiences (Part 1 of 2)
  • Palantir FDSE Intern OA and Interviews: 3 Experiences
  • Palantir FDSE Karat and Learning: 7 Experiences (Part 2 of 2)
All Palantir interview questionsSee Palantir hiring insights
Saved
class Solution {
    public String encryptTransposition(String text, int columns) {
        // Write your code here.
        return "";
    }
}
Checking account…