LC: 1427. Perform String Shifts - spiralgo/algorithms GitHub Wiki
1427. Perform String Shifts:
The Essence:
- We can assume two different shifts in the same direction as a united shift just like vectors in physics. So we can just sum their
amountvalues. - We can assume two different shifts in opposite directions eliminate each other's amount. Then we can subtract the smaller number from the greater one to the net amount value.
Details: After finding the net shift amount, we can use the "substring" method of the String data structure to perform shifting.