give integer array num sort nondecrease order remove duplicate inplace unique element appear twice the relative order element keep samesince impossible change length array language instead result place array num more formally k element remove duplicate k element num hold final result it matter leave k elementsReturn k place final result k slot numsDo allocate extra space array you modify input array inplace O1 extra memoryCustom JudgeThe judge test solution follow codeint num Input arrayint expectednum the expected answer correct lengthint k removeduplicatesnum Calls implementationassert k expectednumslengthfor int 0 k assert numsi expectednumsiif assertion pass solution accept Example 1input num 111223output 5 num 11223_explanation your function return k 5 element num 1 1 2 2 3 respectivelyit matter leave return k underscoresExample 2input num 001111233output 7 num 0011233__explanation your function return k 7 seven element num 0 0 1 1 2 3 3 respectivelyit matter leave return k underscore Constraints1 numslength 3 104104 numsi 104nums sort nondecrease order