Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed out/production/Coding_Interview_in_Java/main.class
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main.java → src/helloworld.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public class main {
public class helloworld {

public static void main(String[] args) {
System.out.println("Hello, World!");
Expand Down
47 changes: 47 additions & 0 deletions src/part_one/GFG.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package part_one;

public class GFG {

void leftRotate(int arr[], int d, int n)
{
// Creating temp array of size d
int temp[] = new int[d];

// Copying first d element in array temp
for (int i = 0; i < d; i++)
temp[i] = arr[i];

// Moving the rest element to index
// zero to N-d
for (int i = d; i < n; i++) {
arr[i - d] = arr[i];
}

// Copying the temp array element
// in original array
for (int i = 0; i < d; i++) {
arr[i + n - d] = temp[i];
}
}

void printArray(int arr[], int n)
{
for (int i = 0; i < n; i++)
System.out.print(arr[i] + " ");
}

public static void main(String[] args) {
System.out.println("Rotate Array in Java");
//Test
GFG rotate = new GFG();

// Custom input array
int arr[] = { 1, 2, 3, 4, 5 };

// Calling method 1 and 2 as defined above
rotate.leftRotate(arr, 2, arr.length);
rotate.printArray(arr, arr.length);

}

}