From e37cd49a121abc943f8aa547524aa911a06fba93 Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sat, 15 Oct 2022 19:44:04 +0530 Subject: [PATCH 1/8] Create anagram.c --- coding_freshmen/C/Rohan/anagram.c | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 coding_freshmen/C/Rohan/anagram.c diff --git a/coding_freshmen/C/Rohan/anagram.c b/coding_freshmen/C/Rohan/anagram.c new file mode 100644 index 0000000..43764c8 --- /dev/null +++ b/coding_freshmen/C/Rohan/anagram.c @@ -0,0 +1,35 @@ +#include +#include + +int main() +{ + char s[100], t[100]; + printf("Enter 1st string: "); + gets(s); + printf("Enter 2nd string: "); + gets(t); + int n = 0; + int len_s = strlen(s); + int len_t = strlen(t); + for (int i = 0; i < len_s; i++) + { + for (int j = 0; j < len_t; j++) + { + if (s[i] == t[j]) + { + n++; + } + } + } + + if (n == len_s) + { + printf("True"); + } + else + { + printf("False"); + } + + return 0; +} From 5383bfb07f216a143c8b77c66dd5e2f66a850a51 Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sat, 15 Oct 2022 19:44:27 +0530 Subject: [PATCH 2/8] Create anagram.md --- coding_freshmen/C/Rohan/anagram.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 coding_freshmen/C/Rohan/anagram.md diff --git a/coding_freshmen/C/Rohan/anagram.md b/coding_freshmen/C/Rohan/anagram.md new file mode 100644 index 0000000..56c814a --- /dev/null +++ b/coding_freshmen/C/Rohan/anagram.md @@ -0,0 +1,19 @@ +# +Anagram + +# Problem Explanation 🚀 +An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. + +# Your logic 🤯 +* Approach: Created two arrays to hold the string and compared the array one by one +* Own test cases if any +* Code Structure and Libraries used + +# Time Complexity and Space Complexity +```cpp +Example + +Time Complexity -> O(n^2) +Space Complexity -> O(1) + +``` From 8715a8dd7cf6eaeb3d67d7a501f25f285fe8c5a8 Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sat, 15 Oct 2022 21:01:17 +0530 Subject: [PATCH 3/8] Create Anagram in Java --- coding_freshmen/JAVA/Swayam/Anagram in Java | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 coding_freshmen/JAVA/Swayam/Anagram in Java diff --git a/coding_freshmen/JAVA/Swayam/Anagram in Java b/coding_freshmen/JAVA/Swayam/Anagram in Java new file mode 100644 index 0000000..db5ad11 --- /dev/null +++ b/coding_freshmen/JAVA/Swayam/Anagram in Java @@ -0,0 +1,32 @@ +import java.io.*; +import java.util.Arrays; +import java.util.Collections; +class Main { +static boolean checkAnagram(char[] strana1, char[] strana2) +{ + +int len1 = strana1.length; +int len2 = strana2.length; + +if (len1 != len2) +return false; + +Arrays.sort(strana1); +Arrays.sort(strana2); + +for (int i = 0; i < len1; i++) +if (strana1[i] != strana2[i]) +return false; +return true; +} + +public static void main (String args[]) +{ +char strana1[] = { 't', 'e', 's', 't' }; +char strana2[] = { 't', 't', 'e', 'w' }; +if (checkAnagram(strana1, strana2)) +System.out.println("The strings to be checked are" + " anagram of each other"); +else +System.out.println("The strings to be checked are not" + " anagram of each other"); +} +} From e46d761bc190a7e13ab38761b3848532e48174cd Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sat, 15 Oct 2022 21:01:35 +0530 Subject: [PATCH 4/8] Create Anagram.md --- coding_freshmen/JAVA/Swayam/Anagram.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 coding_freshmen/JAVA/Swayam/Anagram.md diff --git a/coding_freshmen/JAVA/Swayam/Anagram.md b/coding_freshmen/JAVA/Swayam/Anagram.md new file mode 100644 index 0000000..56c814a --- /dev/null +++ b/coding_freshmen/JAVA/Swayam/Anagram.md @@ -0,0 +1,19 @@ +# <Title of the Problem> +Anagram + +# Problem Explanation 🚀 +An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. + +# Your logic 🤯 +* Approach: Created two arrays to hold the string and compared the array one by one +* Own test cases if any +* Code Structure and Libraries used + +# Time Complexity and Space Complexity +```cpp +Example + +Time Complexity -> O(n^2) +Space Complexity -> O(1) + +``` From 800b64d4fbb7211de99e7c973c36be9cf1bad978 Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sat, 15 Oct 2022 21:05:42 +0530 Subject: [PATCH 5/8] Delete coding_freshmen/C/Rohan directory --- coding_freshmen/C/Rohan/anagram.c | 35 ------------------------------ coding_freshmen/C/Rohan/anagram.md | 19 ---------------- 2 files changed, 54 deletions(-) delete mode 100644 coding_freshmen/C/Rohan/anagram.c delete mode 100644 coding_freshmen/C/Rohan/anagram.md diff --git a/coding_freshmen/C/Rohan/anagram.c b/coding_freshmen/C/Rohan/anagram.c deleted file mode 100644 index 43764c8..0000000 --- a/coding_freshmen/C/Rohan/anagram.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <stdio.h> -#include <string.h> - -int main() -{ - char s[100], t[100]; - printf("Enter 1st string: "); - gets(s); - printf("Enter 2nd string: "); - gets(t); - int n = 0; - int len_s = strlen(s); - int len_t = strlen(t); - for (int i = 0; i < len_s; i++) - { - for (int j = 0; j < len_t; j++) - { - if (s[i] == t[j]) - { - n++; - } - } - } - - if (n == len_s) - { - printf("True"); - } - else - { - printf("False"); - } - - return 0; -} diff --git a/coding_freshmen/C/Rohan/anagram.md b/coding_freshmen/C/Rohan/anagram.md deleted file mode 100644 index 56c814a..0000000 --- a/coding_freshmen/C/Rohan/anagram.md +++ /dev/null @@ -1,19 +0,0 @@ -# <Title of the Problem> -Anagram - -# Problem Explanation 🚀 -An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. - -# Your logic 🤯 -* Approach: Created two arrays to hold the string and compared the array one by one -* Own test cases if any -* Code Structure and Libraries used - -# Time Complexity and Space Complexity -```cpp -Example - -Time Complexity -> O(n^2) -Space Complexity -> O(1) - -``` From 70b0965af7ef6398bdd30c56ab6910ffe35c9ec6 Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sun, 16 Oct 2022 14:24:23 +0530 Subject: [PATCH 6/8] Create Sort_1.py --- coding_freshmen/PYTHON/Sort_1.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 coding_freshmen/PYTHON/Sort_1.py diff --git a/coding_freshmen/PYTHON/Sort_1.py b/coding_freshmen/PYTHON/Sort_1.py new file mode 100644 index 0000000..52dd11f --- /dev/null +++ b/coding_freshmen/PYTHON/Sort_1.py @@ -0,0 +1,11 @@ +import array as arr +arrr = arr.array('i',[4,2,5,9,1,8,6]) +def bubblesort(arrr): +for j in range(len(arrr)-1,0,-1): +for i in range(j): +if arrr[i]> arrr[i+1]: +temp = arrr[i] +arrr[i] = arrr[i+1] +arrr[i+1] = temp +bubblesort(arrr) +print(arrr) From b33d862783440b95edff2889c8692ca66df45df1 Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sun, 16 Oct 2022 14:31:57 +0530 Subject: [PATCH 7/8] Create Product_Finder.py --- coding_freshmen/PYTHON/YTERWQ/Product_Finder.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 coding_freshmen/PYTHON/YTERWQ/Product_Finder.py diff --git a/coding_freshmen/PYTHON/YTERWQ/Product_Finder.py b/coding_freshmen/PYTHON/YTERWQ/Product_Finder.py new file mode 100644 index 0000000..8bf5466 --- /dev/null +++ b/coding_freshmen/PYTHON/YTERWQ/Product_Finder.py @@ -0,0 +1,12 @@ +def product(ar, n): + + result = 1 + for i in range(0, n): + result = result * ar[i] + return result +ar = [ 1, 2, 3, 4, 5 ] +n = len(ar) + +print(product(ar, n)) + + From 4ce4626da4aac2c0fe68199515ea0aa0b27d6d41 Mon Sep 17 00:00:00 2001 From: heyswayam2 <115879102+heyswayam2@users.noreply.github.com> Date: Sun, 16 Oct 2022 14:33:39 +0530 Subject: [PATCH 8/8] Create Readme.md --- coding_freshmen/PYTHON/YTERWQ/Readme.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 coding_freshmen/PYTHON/YTERWQ/Readme.md diff --git a/coding_freshmen/PYTHON/YTERWQ/Readme.md b/coding_freshmen/PYTHON/YTERWQ/Readme.md new file mode 100644 index 0000000..c077100 --- /dev/null +++ b/coding_freshmen/PYTHON/YTERWQ/Readme.md @@ -0,0 +1,25 @@ +# <Title of the Problem> +Pivot_Product_Array + +# Problem Explanation 🚀 +you are given an array of size n. + +you need to find the product of the elements of the array except the pivot element. + +Input array = [0, 1, 0, 1, 0, 0, 1, 1, 1, 0] + +Output array = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + +# Your logic 🤯 +* Approach: Compared each element of the array with the rest of the elements and sorted accordingly +* Own test cases if any +* Code Structure and Libraries used + +# Time Complexity and Space Complexity +```cpp +Example + +Time Complexity -> O(n^2) +Space Complexity -> O(1) + +```