- Designing Hash Keys:
- When the order of each element in the string / array doesn't matter, you can use the sorted string / array as the key
- If you only care abour the offset of each value, usually the offset from the first value, you can use the offset as the key
- In a tree, you might want to directly use the TreeNode as the key, but is MOST cases, the serialization of the subtree might be a better idea.
- In a matrix, you might want to use the row and column index as a key
- Sometimes, you might want to aggregate the values in the same diagonal line