1. Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?
- Asks question about charset/encoding. And use info for quick exit condition.
- Use a map.
- Use search based approach.
- Uses a bit vector(Advanced!).
2. Create a function that by a given object, key name and key value - returns a new object with the updated values for the specific key
- Duplicated keys?
- Object in updated key?
- Mutable vs immutable approach?
- If different lengths - no permutation.
- Is it case insensitive?
- Sort strings.
- Check for char counts - maps.
Example input: [[1,2],[3,4]]
Example output: [1,2,3,4]
Example input: [[1,[2],[3,[4]]
Example output: [1,2,3,4]
Example input object:
{
"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": {
"onclick": "CreateNewDoc()"
}
}
}}
Example property to search for: onclick
Example path output: popup > menuitem > onclick