From 0471ed019349228eb47cf21c09f1722c071e6bb9 Mon Sep 17 00:00:00 2001 From: ImmidiSivani <147423543+ImmidiSivani@users.noreply.github.com> Date: Sat, 15 Jun 2024 20:45:08 +0530 Subject: [PATCH 1/2] added atleast 2 greater elements solution --- .../0003-at-least-two-greater-elements.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md b/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md index 17f07b608..181c0e813 100644 --- a/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md +++ b/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md @@ -84,6 +84,24 @@ The problem is to find all elements in an array except the two greatest elements ``` + + + ```Java + class Solution { + public long[] findElements( long a[], long n) + { + // Your code goes here + long[] ans=new long[a.length-2]; + Arrays.sort(a); + for(int i=0;i From ddb3cdabc39eadd6c105dc2d3906c3d9b2d78bc9 Mon Sep 17 00:00:00 2001 From: Ajay Dhangar <99037494+Ajay-Dhangar@users.noreply.github.com> Date: Sun, 16 Jun 2024 05:58:01 +0530 Subject: [PATCH 2/2] Update 0003-at-least-two-greater-elements.md --- .../gfg-solutions/0003-at-least-two-greater-elements.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md b/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md index 181c0e813..d0018ea45 100644 --- a/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md +++ b/dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md @@ -82,10 +82,9 @@ The problem is to find all elements in an array except the two greatest elements } }; ``` - - - + + ```Java class Solution { public long[] findElements( long a[], long n) @@ -100,7 +99,6 @@ The problem is to find all elements in an array except the two greatest elements } } ``` - @@ -140,4 +138,4 @@ Auxiliary Space: The auxiliary space complexity is $O(N)$ because the sorting al - **Geeks for Geeks Problem:** [Geeks for Geeks Problem](https://www.geeksforgeeks.org/problems/at-least-two-greater-elements4625/1?page=1&difficulty=School&sortBy=difficulty) - **Solution Link:** [At Least Two Greater Elements on Geeks for Geeks](https://www.geeksforgeeks.org/problems/at-least-two-greater-elements4625/1?page=1&difficulty=School&sortBy=difficulty) -- **Authors LeetCode Profile:** [Anoushka](https://www.geeksforgeeks.org/user/iamanolive/) \ No newline at end of file +- **Authors LeetCode Profile:** [Anoushka](https://www.geeksforgeeks.org/user/iamanolive/)