import time


def generate_stats_table(stats: dict) -> str:
    """Function to generate md table with questions stats.

    Args:
      stats: Stats dict. 

            {
                "category": {
                    "title" str,
                    "cnt": int,
                }
            }

    Returns:
      Md table string.
    """
    cnt_total = sum([v['cnt'] for v in stats.values()])

    header = f"""## Questions categories
    
*Total number of questions as of {time.strftime('%Y-%m-%d', time.gmtime())}*: **{cnt_total}**
"""

    table_body = "\n".join([f"|[{v['title']}](questions/{k}/)|{v['cnt']}|"
                            for k, v in stats.items()])
    return f"""{header}\n
|Category|Number of questions|
|:-:|-:|
{table_body}"""