Skip to content

Commit

Permalink
Merge pull request #3 from raydelto/master
Browse files Browse the repository at this point in the history
Rewording leftRotation comments
  • Loading branch information
lolapriego authored Mar 1, 2023
2 parents f5bf7ee + f415d38 commit 2db066f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions topic1_arrays/LeftRotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
public class Solution {

static int[] leftRotation(int[] a, int d) {
// They say in requirements that these inputs should not be considered.
// However, noting that we should prevent against those.
// They say in the requirements that these inputs should not be considered;
// however, were are handling it for consistency sake.
if (d == 0 || a.length == 0) {
return a;
}
Expand All @@ -28,9 +28,9 @@ static int[] leftRotation(int[] a, int d) {
}

/**
* Takes care of the case where the rotation index. You have to take into account
* how it is rotated towards the left. To compute index of B, we rotate towards the right.
* If we were to do a[i] in the loop, then these method would need to be slightly chnaged
* Takes care of the index rotation. You have to take into account
* how it is rotated towards the left: To compute index of B, we rotate towards the right.
* If we were to do a[i] in the loop, then these method would need to be slightly changed
* to compute index of b.
*/
private static int indexHelper(int index, int length) {
Expand Down

0 comments on commit 2db066f

Please sign in to comment.