Java Only There are 2 best friends and they both jumped into the crowd. Chris Martin points to N number of followers one at a time. Imagine endless fans arranged with a 2D infinte grid, with each...


Java Only<br>There are 2 best friends and they both jumped into the crowd. Chris Martin points to N number of<br>followers one at a time. Imagine endless fans arranged with a 2D infinte grid, with each follower<br>standing at each step in an orderly fashion. Chris gives them directions in the form of an S unit and<br>they follow blindly. As a result, few fans appear with more than one T-shirt.<br>They start at the same place (bring two T-shirts to the same starting fan), and take turns based on<br>orders from Chris, who gives them orders as follows:<br>U- Move up the stairs<br>D - Go Down one step<br>L- Go Left one step<br>R- Go Right one step<br>Given the S-letter unit of the instructions given to Chris. Which brings out the number of lucky fans<br>who have received at least one T-Shirt.<br>Input:<br>2<br>UD<br>Output:<br>3<br>

Extracted text: Java Only There are 2 best friends and they both jumped into the crowd. Chris Martin points to N number of followers one at a time. Imagine endless fans arranged with a 2D infinte grid, with each follower standing at each step in an orderly fashion. Chris gives them directions in the form of an S unit and they follow blindly. As a result, few fans appear with more than one T-shirt. They start at the same place (bring two T-shirts to the same starting fan), and take turns based on orders from Chris, who gives them orders as follows: U- Move up the stairs D - Go Down one step L- Go Left one step R- Go Right one step Given the S-letter unit of the instructions given to Chris. Which brings out the number of lucky fans who have received at least one T-Shirt. Input: 2 UD Output: 3

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here