I don't know how to do this task, please help me. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I don't know how to do this task, please help me.

The sequence of Latin letters is constructed as follows: first it is empty. At each successive step, the sequence doubles, after which the regular letter of the Latin alphabet is appended to it (A, B, C,...). Define a character that stands on nth position in a sequence received after a step that is set by a user

23rd Feb 2020, 7:17 AM
Анастасия
Анастасия - avatar
1 Answer
0
My understanding of your task description, it builds up the sequence like this A AAB AABAABC AABAABCAABAABCD and so on. You can use a list to build up the elements. List.Add() to append a letter to the end. List.AddRange() to append the whole list to itself. Repeat this until the size of the list is at least n, then take the nth element. Edit: actually you can do the same without lists, just using string...
23rd Feb 2020, 7:42 AM
Tibor Santa
Tibor Santa - avatar