Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,24 @@ The problem is to find all elements in an array except the two greatest elements
}
};
```

</TabItem>
<TabItem value="Java" label="java">
<SolutionAuthor name="@ImmidiSivani"/>
```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<a.length-2;i++){
ans[i]=a[i];
}
return ans;
}
}
```
</TabItem>
</Tabs>


Expand Down Expand Up @@ -122,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/)
- **Authors LeetCode Profile:** [Anoushka](https://www.geeksforgeeks.org/user/iamanolive/)