id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-encryption > apcsaDecryptColumnarCipher
prev  |  next  |  chance

Given a String ciphertext and a keyword of length n, decrypt the columnar transposition cipher described at the following page:


https://en.wikipedia.org/wiki/Transposition_cipher#Columnar_transposition

Note that this is the irregular version with no "filler" letters to complete the rectangle if it is not completely filled.  It is quite possible that the last row of plaintext, therefore, will be a different length than the other rows.  Having unequal length rows also makes for an additional challenge writing the columns into the output.

The first test case uses only letters for plaintext and key, but actually, in theory, this cipher can function with any visible characters.

apcsaDecryptColumnarCipher("EVLNACDTESEAROFODEECWIREE", "ZEBRAS") → "WEAREDISCOVEREDFLEEATONCE"
apcsaDecryptColumnarCipher("EVLNACDTESEAROFODEECWIREE", "FCBDAE") → "WEAREDISCOVEREDFLEEATONCE"
apcsaDecryptColumnarCipher("EVLNACDTESEAROFODEECWIREE", "521304") → "WEAREDISCOVEREDFLEEATONCE"

...Save, Compile, Run (ctrl-enter)

public String apcsaDecryptColumnarCipher(String ciphertext, String key) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 330

Copyright Nick Parlante 2017 - privacy