WMZ|A|B|C|DE
1. Circular Printer
A company has invented a new type of
printing technology-a circular printer that
looks like this:
EIES
GH
Ple/
AOININ
The printer has a pointer that is initially at
Answers
Answered by
3
Answer:
eies is old computer 1 st used in world
Explanation:
Answered by
0
Answer:
The printer has a pointer that is initially at a.
Explanation:
A circular printer container consisting of lowercase alphabets from ‘a’ to ‘z’, a pointer pointing first at alphabet ‘a’, and a string "str", the task is to find the minimum time required to print the given string "str" from the circular container, based on below mentioned operations that can be performed on every character:
- Move the pointer one character anti-clockwise or clockwise in one unit time
- Print the character in one unit time, and then move the pointer to the next index of the string
Below steps can be followed to solve the given problem:
- Calculate time required to reach character index from current pointer index in both directions:
- clockwise time is calculated by taking absolute difference of both indices
- anti-clockwise time is calculated by subtracting clockwise time from 26
- Minimum of both times obtained in the previous step is added to the answer
- Then print the character, one unit time is also added to the answer
Finally print the answer obtained as the minimum time required.
#SPJ3
Similar questions