Post History
Challenge Given an array consisting of positive integers and 0s, return it with 0s acting like backspaces. Leading backspaces do nothing, and more backspaces than elements also does nothing. Cre...
Question
code-golf
#4: Post edited
- ## Challenge
Given an array, return it with 0s acting like backspaces.- Leading backspaces do nothing, and more backspaces than elements also does nothing.
- Credit: A comment on this [video](https://www.youtube.com/watch?v=erv_1LxEByk)
- ## Test Cases
- ```
- [0,0,0,0,0,5,7] -> [5,7]
- [1,2,0,3] -> [1,3]
- [1,5,5,0,2,0,0,8] -> [1,8]
- [1,2,3,4,0,0,9] -> [1,2,9]
- [1,2,0,0,0,0,0] -> []
- ```
- ## Challenge
- Given an array consisting of positive integers and 0s, return it with 0s acting like backspaces.
- Leading backspaces do nothing, and more backspaces than elements also does nothing.
- Credit: A comment on this [video](https://www.youtube.com/watch?v=erv_1LxEByk)
- ## Test Cases
- ```
- [0,0,0,0,0,5,7] -> [5,7]
- [1,2,0,3] -> [1,3]
- [1,5,5,0,2,0,0,8] -> [1,8]
- [1,2,3,4,0,0,9] -> [1,2,9]
- [1,2,0,0,0,0,0] -> []
- ```
#3: Post edited
- ## Challenge
- Given an array, return it with 0s acting like backspaces.
- Leading backspaces do nothing, and more backspaces than elements also does nothing.
Credit: A comment on this video <https://www.youtube.com/watch?v=erv_1LxEByk>- ## Test Cases
- ```
- [0,0,0,0,0,5,7] -> [5,7]
- [1,2,0,3] -> [1,3]
- [1,5,5,0,2,0,0,8] -> [1,8]
- [1,2,3,4,0,0,9] -> [1,2,9]
- [1,2,0,0,0,0,0] -> []
- ```
- ## Challenge
- Given an array, return it with 0s acting like backspaces.
- Leading backspaces do nothing, and more backspaces than elements also does nothing.
- Credit: A comment on this [video](https://www.youtube.com/watch?v=erv_1LxEByk)
- ## Test Cases
- ```
- [0,0,0,0,0,5,7] -> [5,7]
- [1,2,0,3] -> [1,3]
- [1,5,5,0,2,0,0,8] -> [1,8]
- [1,2,3,4,0,0,9] -> [1,2,9]
- [1,2,0,0,0,0,0] -> []
- ```
#2: Post edited
- ## Challenge
- Given an array, return it with 0s acting like backspaces.
- Leading backspaces do nothing, and more backspaces than elements also does nothing.
Credit: A comment on this video https://www.youtube.com/watch?v=erv_1LxEByk- ## Test Cases
- ```
- [0,0,0,0,0,5,7] -> [5,7]
- [1,2,0,3] -> [1,3]
- [1,5,5,0,2,0,0,8] -> [1,8]
- [1,2,3,4,0,0,9] -> [1,2,9]
- [1,2,0,0,0,0,0] -> []
- ```
- ## Challenge
- Given an array, return it with 0s acting like backspaces.
- Leading backspaces do nothing, and more backspaces than elements also does nothing.
- Credit: A comment on this video <https://www.youtube.com/watch?v=erv_1LxEByk>
- ## Test Cases
- ```
- [0,0,0,0,0,5,7] -> [5,7]
- [1,2,0,3] -> [1,3]
- [1,5,5,0,2,0,0,8] -> [1,8]
- [1,2,3,4,0,0,9] -> [1,2,9]
- [1,2,0,0,0,0,0] -> []
- ```
#1: Initial revision
Backspace an array
## Challenge Given an array, return it with 0s acting like backspaces. Leading backspaces do nothing, and more backspaces than elements also does nothing. Credit: A comment on this video https://www.youtube.com/watch?v=erv_1LxEByk ## Test Cases ``` [0,0,0,0,0,5,7] -> [5,7] [1,2,0,3] -> [1,3] [1,5,5,0,2,0,0,8] -> [1,8] [1,2,3,4,0,0,9] -> [1,2,9] [1,2,0,0,0,0,0] -> [] ```