You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Space:- O(1) (No extra space for return vector)
// Firstly, It is very intuitive to come up with using O(N) space to store the information.
// e.g. [ 4, 3, 2, 7, 8, 2, 3, 1] we can use a binary array (O(N) space) to count it. [ 1, 1, 1, 1, 0, 0, 1, 1]
// Note that it has the same amount of information with [ -, -, -, -, +, +, -, -] . You can just attach this information to the original array without generating a new array. That's the whole point.