Skip to content

Commit

Permalink
Adding pass by value concept wrt array
Browse files Browse the repository at this point in the history
  • Loading branch information
iAdityaNarayanT committed Aug 10, 2022
1 parent 0563293 commit c719d82
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions Arrays/src/com/aditya/LeetCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@

public class LeetCode {
public static void main(String[] args) {
int[] nums ={1,2,1};
System.out.println(Arrays.toString(getConcatenation(nums)));
int[] nums ={8,1,2,2,3};
// System.out.println(Arrays.toString(peakElement(nums)));
}

static int[] getConcatenation(int[] nums) {
int n= nums.length;
int[] ans= new int[2*n];
for (int i = 0; i <n; i++) {
ans[i]=nums[i];
ans[i+n]=nums[i];
}
// for (int i = 0; i <n; i++) {
// ans[i+n]=nums[i];
// // Function to find the peak element
// // arr[]: input array
// // n: size of array a[]
// public static int[] peakElement(int[] nums){
//
//
// }
return ans;
}
}

0 comments on commit c719d82

Please sign in to comment.