Company: Autodesk SDE intern on campus_9april
Difficulty: medium
You are given a binary array state consisting of integers 0 and 1 . You are also given operations - an array of strings, each representing an operation of one of two types: "L" - find the smallest index i , for which state[i] = 0 , and set state[i] = 1 . If there is no such index, do nothing. "C{index}" - set state[index] = 0 . This operation does not depend on the previous value of state[index] . It is guaranteed that index is a valid 0-based index of state (ie: index < state.length ). Given state and operations , your task is to return the binary string of state array after all the operations have been applied. Example For state = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] and operations = ["L", "L", "C0", "L", "C3"] , the output should be solution(state, operations) = "1100000000" . Note: If you are not able to see the video, use this link to access it. Initially the state is [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] . On the 1 st operation "L" , the smallest index with state[i] = 0 is i = 0 . After th