Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn't matter what you leave beyond the new length.
NOTE:
- Do not allocate extra space for another array.
- You must do this by modifying the input array in-place with O(1) extra memory.
This problem is popular in LeetCode, LeetCode forum, StackOverFlow A collection of hundreds of interview questions and solutions are available in our blog at Interview Question Solutions
SOLUTION:
Source code: Java
SOLUTION:
Source code: Java
No comments:
Post a Comment