Refactor Code Style (#4151)

This commit is contained in:
Saurabh Rahate
2023-04-15 13:55:54 +05:30
committed by GitHub
parent 1ce907625b
commit 1dc388653a
100 changed files with 293 additions and 319 deletions

View File

@ -28,9 +28,9 @@ public class SaddlebackSearch {
* @return The index(row and column) of the element if found. Else returns
* -1 -1.
*/
private static int[] find(int arr[][], int row, int col, int key) {
private static int[] find(int[][] arr, int row, int col, int key) {
// array to store the answer row and column
int ans[] = { -1, -1 };
int[] ans = { -1, -1 };
if (row < 0 || col >= arr[row].length) {
return ans;
}
@ -54,7 +54,7 @@ public class SaddlebackSearch {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int arr[][];
int[][] arr;
int i, j, rows = sc.nextInt(), col = sc.nextInt();
arr = new int[rows][col];
for (i = 0; i < rows; i++) {
@ -64,7 +64,7 @@ public class SaddlebackSearch {
}
int ele = sc.nextInt();
// we start from bottom left corner
int ans[] = find(arr, rows - 1, 0, ele);
int[] ans = find(arr, rows - 1, 0, ele);
System.out.println(ans[0] + " " + ans[1]);
sc.close();
}