Ayush7614 / Ayush7614/Daily-Coding-DS-ALGO-Practice
Next Greater Element
- Dominant language
- C++
- Stars
- 323
- Forks
- 472
- PR merge metrics
- No merged PRs in 30d
Description
@Amit366 and @Ayush7614 I want to add solution of Next Greater Element (NGE)in Java.
Question Explanation-The NGE of element P is the first element greater than P on the right side of it in array.If there is no NGE it should return -1
Input->[4, 5, 2, 25,20]
Output->[5,25,25,-1,-1]
Output Explanation- here NGE of 4 is 5 and NGE of both 5 and 2 is 25 but there is no NGE of 25(as all elements on right of 25 are less than it) so it return -1.NGE of last element is always-1 since it has no element on right of it
-->
- [ ] C
- [ ] C++
- [ ] Java
- [ ] Python
Please assign this issue to me.
Language-Java
Contributor guide
Assessment
This issue has not been assessed yet.