Skip to content

Commit 0471ed0

Browse files
committed
added atleast 2 greater elements solution
1 parent 8c1fbdd commit 0471ed0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

dsa-solutions/gfg-solutions/0003-at-least-two-greater-elements.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ The problem is to find all elements in an array except the two greatest elements
8484
```
8585
8686
</TabItem>
87+
<TabItem value="Python" label="Python" default>
88+
<SolutionAuthor name="@iamanolive"/>
89+
```Java
90+
class Solution {
91+
public long[] findElements( long a[], long n)
92+
{
93+
// Your code goes here
94+
long[] ans=new long[a.length-2];
95+
Arrays.sort(a);
96+
for(int i=0;i<a.length-2;i++){
97+
ans[i]=a[i];
98+
}
99+
return ans;
100+
}
101+
}
102+
```
103+
104+
</TabItem>
87105
</Tabs>
88106

89107

0 commit comments

Comments
 (0)