about summary refs log tree commit diff
path: root/todo-lists/imdb/db.sqlite3
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-12-25T03·52+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-12-25T03·52+0000
commit93d7b5d8eaea4125c3ddd774bb2b8949b1ccce68 (patch)
tree439e3f33ac84ccc5bfc39c4f7e113c25b99534d5 /todo-lists/imdb/db.sqlite3
parentc34a3e2e97ce640a5ab7042d1ec977be71088ddd (diff)
Solve a few String questions
Valid Anagram

This one is a classic: `sorted(a) == sorted(b)`

Group Anagrams

Using product of prime numbers to create a key for anagrams is much faster than
sorting the characters in each word. It is also satisfyingly simple.

Encode and Decode Strings

My initial implementation was clumsy and prone to fail for edge-cases. A more
elegant solution is using something like:

```python
def encode(words):
  return "".join("{}:{}".format(len(x), x) for x in words)
```
Diffstat (limited to 'todo-lists/imdb/db.sqlite3')
0 files changed, 0 insertions, 0 deletions