- ShiftBoxes -
- Given a matrix, it has obstacles and boxes and empty spaces, first shift all the boxes to right and then shift all the boxes down, return the final state of matrix
- Eg: Input = [
['.', '#', '.', '*', '.'] ,
['.', ''.', '.', '.', '.'],
['#', '.', '.', '*', '#']
] (here '.' empty slots, '#' boxes, '*' obstacles)
output = [
['.', '.', '.' , '*', '.'] ,
['.', ''.', '#', '.', '.'],
['.', '.', '#', '*', '#']
]
- OddAndEvenParity -
- Given an array, find total no of contigous subarrays with odd and even alternate parity.
- Eg: Input = [ 1, 2, 3, 5]
arrays (for explanation) = [[1], [1, 2], [2], [1, 2, 3], [2, 3], [3], [5]] ,
output = 7
Any ideas to solve these problems ?