Count + Convert (R-80%+, M-70%+)
Complexity
Time complexity: O(n * log n)
n - length of the input array orders

Space complexity: O(n)
Code
# Complexity
- Time complexity: **O(n * log n)**
**n** - length of the input array `orders`
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: **O(n)**
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def displayTable(self, orders: List[List[str]]) -> List[List[str]]:
        # { all unique food items }
        all_items: set[str] = set()
        # { table: { item: orders } }
        tables:  dict[str, dict[str, int]] = defaultdict(dict)
        for _, table, item in orders:
            all_items.add(item)
            item_quant: int  = tables[table].get(item)
            if item_quant is None:
                tables[table][item] = 1
                continue
            tables[table][item] += 1
        # ! each food item in alphabetical order !
        alph_items: list[str] = sorted(all_items)
        out: list[list[str]] = [ ['Table'] + alph_items ]
        # ! rows should be sorted in numerically increasing order !
        for table in sorted(tables.keys(), key=lambda x: int(x)):
            new_row: list[str] = [table]
            for item in alph_items:
                if item in tables[table]:
                    new_row.append(str(tables[table][item]))
                else:
                    new_row.append('0')
            out.append(new_row)

        return out
```
['Array', 'Hash Table', 'String', 'Sorting', 'Python3']