Arrays & Strings
Is Unique
- Implement an algo. to determine if a string has all unique characters. What if you cannot use additional data structures ?
- Is given string ASCII or UNICODE, because if UNICODE will be there then we need to increase the array size.
- Sorting & then find continous elements
- Time Complexity - O(NlogN)
- Space Complexity - O(N)
- Comparing each char. with others,
- using 2 nested loops
- time complexity - O(N^2)
- space complexity - O(1)
- Optimal Solution - we can create a boolean array of total space of characters & iterate over string once.
- Time Complexity - O(n)
- Space Complexity - O(1)
- Implement an algo. to determine if a string has all unique characters. What if you cannot use additional data structures ?
Check Permutation
URLify
Palindromic Permutation
One Away
String Compression
Rotate Matrix
Zero Matrix
String Rotation