Practice: Arrays and strings
0 of 4 solved
About these problems
Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.
- 1Reverse the queueA queue holds n integers, given as a list a1, a2, ..., an from front to back. Print the list in reverse order, from back to front.ApplyNot started
- 2Longest signalA string s of lowercase English letters records a sequence of signals, one letter per signal. Print the length of the longest block of consecutive equal letters in s.ConnectNot started
- 3Rotate the displayA display shows a list of n integers a1, a2, ..., an. One step moves the last element of the list to the front. Print the list after k steps. Note that k may be larger than n.ReasonNot started
- 4Row and column totalsA grid has n rows and m columns, and each cell holds an integer. Print the sum of each row, from top to bottom, and then the sum of each column, from left to right.StretchNot started