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

 

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

Given a ciphertext String and a hint, find the plaintext by reversing the "differences" algorithm from the previous problem. That is, each ciphertext character should be scaled to a range of 0-94 instead of 32-126, then used to compute the difference between one character and the next. The interesting part of this challenge is determining the direction of the shift from one character to the next (positive or negative). The hint is the first character of the plaintext, which can then be used to reconstruct the remainder of the plaintext using the algorithm.


Precondition: the plaintext used to create the ciphertext will only contain characters in the ASCII visible range (32-126), and the ciphertext length is at least 2 characters.

apcsaDecryptDifferences("!!}", "A") → "ABC"
apcsaDecryptDifferences("!!!!!!!!!v", "0") → "0123456789"
apcsaDecryptDifferences("!!!!!!!!!!!!!!!!!!!!!!!!!f", "a") → "abcdefghijklmnopqrstuvwxyz"

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

public String apcsaDecryptDifferences(String ciphertext, char hint) { }

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

Copyright Nick Parlante 2017 - privacy