diff --git a/.gitignore b/.gitignore index 1d3f569..b0ce1b9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,11 @@ # Ignore all local history of files .history .ionide +.idea + # Executables *.exe *.out -*.app \ No newline at end of file +*.app +*.iml \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/CodeToGrow.iml b/.idea/CodeToGrow.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/CodeToGrow.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..f5cb871 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ee9b99d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Basic of Programming/Arrays/Arrays.iml b/Basic of Programming/Arrays/Arrays.iml new file mode 100644 index 0000000..eaaf637 --- /dev/null +++ b/Basic of Programming/Arrays/Arrays.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Basic of Programming/Arrays/Q1 Reverse the array/Sol.java b/Basic of Programming/Arrays/Q1 Reverse the array/Sol.java new file mode 100644 index 0000000..4d926bf --- /dev/null +++ b/Basic of Programming/Arrays/Q1 Reverse the array/Sol.java @@ -0,0 +1,34 @@ +import java.util.*; +class Sol{ + + public static void main(String[] args){ + Scanner sc = new Scanner(System.in); + System.out.println("Input numbers seperated by space"); + String sin = sc.nextLine(); + String arr[] = sin.trim().split(" "); + int intArr[] = new int[arr.length]; + int i = 0; + for (String s : arr){ + intArr[i] = Integer.parseInt(s); + i++; + } + + int res[] = reverseArray(intArr); + + for (int r : res) + System.out.print(r + " "); + } + + private static int[] reverseArray(int[] intArr) { + int m = intArr.length /2 ; + + for (int i = 0; i <= m ; i++){ + int temp = intArr[i]; + intArr[i] = intArr[intArr.length - i - 1]; + intArr[intArr.length - i - 1] = temp; + } + return intArr; + } + + +} \ No newline at end of file diff --git a/Basic of Programming/Arrays/Q1 Reverse the array/Sol.kt b/Basic of Programming/Arrays/Q1 Reverse the array/Sol.kt new file mode 100644 index 0000000..821923f --- /dev/null +++ b/Basic of Programming/Arrays/Q1 Reverse the array/Sol.kt @@ -0,0 +1,30 @@ +/* +* Input Format 1 2 3 4 5 +* space... +* +* Reverse array by swapping elements. +* +* */ + +fun reverseArray(a: Array): Array { + + var m: Int = a.size / 2 -1 + + for(i in 0..m){ + var temp = a[i] + a[i] = a[a.size-i-1] + a[a.size-i-1] = temp + } + + return a + +} + +fun main(args: Array) { + + val arr = readLine()!!.trimEnd().split(" ").map{ it.toInt() }.toTypedArray() + + val res = reverseArray(arr) + + println(res.joinToString(" ")) +} \ No newline at end of file diff --git a/Basic of Programming/Arrays/Q1 Reverse the array/Sol.py b/Basic of Programming/Arrays/Q1 Reverse the array/Sol.py new file mode 100644 index 0000000..676ab62 --- /dev/null +++ b/Basic of Programming/Arrays/Q1 Reverse the array/Sol.py @@ -0,0 +1,8 @@ +arr = list(map(int,input("Input Numbers Seperated by space\n").strip().split(" "))) + +for i in range(0, len(arr)//2 - 1): + temp = arr[i] + arr[i] = arr[len(arr)-i-1] + arr[len(arr)-i-1] = temp + +print(arr) \ No newline at end of file diff --git a/Basic of Programming/Matrix/Matrix.iml b/Basic of Programming/Matrix/Matrix.iml new file mode 100644 index 0000000..7a5a0f4 --- /dev/null +++ b/Basic of Programming/Matrix/Matrix.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Recursion and Back Tracking/Level-1/Recursion In Array/Recursion In Array.iml b/Recursion and Back Tracking/Level-1/Recursion In Array/Recursion In Array.iml new file mode 100644 index 0000000..a2a77fb --- /dev/null +++ b/Recursion and Back Tracking/Level-1/Recursion In Array/Recursion In Array.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Recursion and Back Tracking/Level-1/Recursion-Basics/Recursion-Basics.iml b/Recursion and Back Tracking/Level-1/Recursion-Basics/Recursion-Basics.iml new file mode 100644 index 0000000..75d884b --- /dev/null +++ b/Recursion and Back Tracking/Level-1/Recursion-Basics/Recursion-Basics.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file