Strings Flashcards
1
Q
What is a String?
A
A sequence of characters. Many tips that apply to arrays also apply to strings.
2
Q
Time Complexity of Inserting an element to a String
A
O(n)
3
Q
Time Complexity for Removing an element in a String
A
O(n)
4
Q
Time Complexity for Searching for an element in String
A
O(n)
5
Q
Time Complexity for Accessing an element in a String
A
O(1)
6
Q
4 Common Corner Cases (String problems)
A
- empty string
- String with 1 or 2 characters
- String with repeated characters
- String with only distinct characters