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

 

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

Given an input String and a number of rails, encode it using a rail fence cipher and return the ciphertext. The rail fence cipher is described here:


https://en.wikipedia.org/wiki/Rail_fence_cipher

Precondition: at least two rails.
HINT
You will need to think two-dimensionally...

apcsaEncryptRailFence("WEAREDISCOVERED", 3) → "WECRERDSOEEAIVD"
apcsaEncryptRailFence("helphelpimbeingrepressed", 3) → "hhiiesepepmenrpesdllbgre"
apcsaEncryptRailFence("0123456789", 5) → "0817926354"

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

public String apcsaEncryptRailFence(String plaintext, int numRails) { }

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: 320

Copyright Nick Parlante 2017 - privacy