String Processing in Python: Look-and-Say Sequence

Publié le: 13 February 2018
sur la chaîne: LucidProgramming
19,291
336

In this video, we will be considering the so-called "Look-and-Say" sequence. The first few terms of the sequence are:

1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...

To generate a member of the sequence from the previous member, read off the digits of the previous member, counting the number of digits in groups of the same digit. For example:

1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
1211 is read off as "one 1, one 2, then two 1s" or 111221.
111221 is read off as "three 1s, two 2s, then one 1" or 312211.

More information on the properties of this sequence can be found on the Wikipedia page here:
https://en.wikipedia.org/wiki/Look-an...

We will define the "look-and-say" sequence and also determine a way to generate the nth term in the sequence. We will also code up an implementation in Python that calculates the nth term in the "look-and-say" sequence.

This video is part of a series on string processing and, specifically, on how these problems tend to show up in the context of a technical interview:
http://bit.ly/lp_string

This video is also part of an "Algorithm" series. For more algorithm tutorials:
http://bit.ly/lp_algos

The software written in this video is available at:
https://github.com/vprusso/youtube_tu...

Do you like the development environment I'm using in this video? It's a customized version of vim that's enhanced for Python development. If you want to see how I set up my vim, I have a series on this here:
http://bit.ly/lp_vim

If you've found this video helpful and want to stay up-to-date with the latest videos posted on this channel, please subscribe:
http://bit.ly/lp_subscribe


Sur cette page du site, vous pouvez voir la vidéo en ligne String Processing in Python: Look-and-Say Sequence durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur LucidProgramming 13 February 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 19,291 fois et il a aimé 336 téléspectateurs. Bon visionnage!