Given a list of group names and their original lineup indices, determine which groups that are not on the first position of the stage are able to move to a new index to maintain the correct order within the stage's available space.
Explanation: Step-by-step: Given the input [['Blackpink', 1], ['EXO', 2], ['Red Velvet', 3], ['Twice', 4]], we first check if the group is not at the first position (i.e., its index is not 1). If it is not at the first position, we increment its index by 1. The output is then [1, 2, 3, 4].
Explanation: Step-by-step: Given the input [['BTS', 1], ['BTS', 1], ['BTS', 1], ['BTS', 1]], we first check if the group is not at the first position (i.e., its index is not 1). Since all groups are at the first position, we increment their indices by 1. The output is then [2, 3, 4, 5].
Master coding challenges related to Arrays and solve the [Backup] Array Index Shift problem optimally.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak