Waste less time on Facebook — follow Brilliant.
Back to all chapters


Strings are basically "words in computers". As an ordered set of characters, these are the building blocks that allow us to do things from searching filesystems to decrypting ciphers.

Strings - Intermediate


Given a string, find the length of the longest substring without repeating characters.

For example, the longest substring without repeating letters for "brilliant" is "liant", which has a length of \(5\) characters. For "aaaa" the longest substring is "a", with the length of 1 character.

What is the length of the longest substring without repeating characters for the string below?



  • Note non-repeating means any substring whose characters are all unique, thus abcde is non-repeating, while abece is not non-repeating.

In cryptography, Caesar's cipher is arguably the simplest and most widely known encryption technique.

It is a simple substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a password of 3, A would be replaced by D, B would become E, and so on.

Implement Caesar's cipher and use it to reveal the answer to this problem by decoding the message below.

ugfyjslmdslagfk gf kgdnafy lzak hjgtdwe lzw sfkowj ak log zmfvjwv sfv lowflq log

Substitution ciphers are ciphers in which each alphabetical character is mapped with another character in a one-to-one fashion. For example, the following string

the quick brown fox jumps over the lazy dog

when encrypted becomes

'fzq kpgwj vxbsa rbh lpnic bdqx fzq uomy ebt'

Based on the substitution above, your task is to decipher the text below. Once the text is deciphered, the answer shall be obvious.

'qafqx rbxfy fsb oc fzq oacsqx'


Problem Loading...

Note Loading...

Set Loading...