python 50% (WTF Question is this)
\tclass Solution:\n\t\tdef displayTable(self, orders: List[List[str]]) -> List[List[str]]:\n\t\t\td = dict()\n\t\t\tst = set()\n\t\t\ttn = set()\n\t\t\tfor orde
\tclass Solution:\n\t\tdef displayTable(self, orders: List[List[str]]) -> List[List[str]]:\n\t\t\td = dict()\n\t\t\tst = set()\n\t\t\ttn = set()\n\t\t\tfor order in orders:\n\t\t\t\tuser,table,dish = order\n\n\t\t\t\ttable = int(table)#imp step\n\n\t\t\t\tst.add(dish)\n\t\t\t\ttn.add(table)\n\t\t\t\tif table in d:\n\t\t\t\t\td[table][dish]+=1\n\t\t\t\telse:\n\t\t\t\t\td[table] = defaultdict(int)\n\t\t\t\t\td[table][dish]+=1\n\t\t\t\n\t\t\tdishes = list(st)\n\t\t\ttables = list(tn)\n\n\t\t\tdishes.sort()\n\t\t\ttables.sort()\n\n\t\t\tres = []\n\n\t\t\tfirstRow = ["Table"]\n\t\t\tfor dish in dishes:\n\t\t\t\tfirstRow.append(dish)\n\t\t\t\n\t\t\tres.append(firstRow)\n\n\t\t\tfor table in tables:\n\t\t\t\thmap = d[table]\n\n\t\t\t\tdataRow=[0] * (len(dishes)+1)\n\t\t\t\tdataRow[0] = table\n\t\t\t\t# print(dataRow)\n\t\t\t\tfor i in range(1,len(dishes)+1):\n\t\t\t\t\tdataRow[i]+=hmap[dishes[i-1]]\n\n\t\t\t\tfor i in range(0,len(dataRow)):\n\t\t\t\t\tdataRow[i] = str(dataRow[i])\n\t\t\t\tres.append(dataRow)\n\t\t\t\n\t\t\treturn res\n\n
[]