Opening your workspace…
Workspace/Coding room
Opening your workspace…
Help Light Yagami finish a page of math homework while L watches him on camera. Light traces a graph on squared paper. Each time his pencil reaches a square for the first time, he takes a potato chip and uses the reach into the bag to scribble a name in the hidden Death Note. The starting square earns him his first chip. Given his pencil strokes in order, return how many chips he needs for the page.
[]Output1Light sets his pencil down. Even a graph consisting of a single dot costs him one chip.
["R3","U2","L3","D2"]Output10Light traces a rectangle. Its top and bottom edges cover four squares apiece, and each side adds one square between the corners. Closing the rectangle costs no extra chip.
Mark the starting square before following each stroke one square at a time.
function solve(strokes) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.