{"id":30663466,"url":"https://github.com/simpsonresearch/14uniquechars","last_synced_at":"2025-08-31T17:11:28.638Z","repository":{"id":168438015,"uuid":"644158440","full_name":"simpsonresearch/14uniquechars","owner":"simpsonresearch","description":"Find the first 14 unique characters in a string. Two different algorithm implementations.","archived":false,"fork":false,"pushed_at":"2023-05-23T00:26:51.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-11T15:30:00.993Z","etag":null,"topics":["algorithm","python","speed","teach"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simpsonresearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-23T00:17:01.000Z","updated_at":"2023-05-23T00:17:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"60bf3f8c-1cdf-4a4e-ac3c-0d66c2dd33a9","html_url":"https://github.com/simpsonresearch/14uniquechars","commit_stats":null,"previous_names":["simpson-computer-technologies-research/14uniquechars","simpsonresearch/14uniquechars"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/simpsonresearch/14uniquechars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2F14uniquechars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2F14uniquechars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2F14uniquechars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2F14uniquechars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simpsonresearch","download_url":"https://codeload.github.com/simpsonresearch/14uniquechars/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2F14uniquechars/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273010994,"owners_count":25030369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","python","speed","teach"],"created_at":"2025-08-31T17:11:24.705Z","updated_at":"2025-08-31T17:11:28.624Z","avatar_url":"https://github.com/simpsonresearch.png","language":"Python","readme":"# 14uniquechars\nFind the first 14 unique characters in a string. Two different algorithm implementations.\n\n```py\nimport time\n\ns: str = \"abcdefgghijklmnopqrstuvwxyz\"\nb: bytes = bytes(s, 'ascii')\n\ndef one(start: int) -\u003e str:\n    data: dict[str, int] = {}\n    tot: int = 0\n    if start \u003e= len(s):\n        return \"\"\n    for i in range(len(s)):\n        if s[i] in data:\n            return one(start+1)\n        else:\n            data[s[i]] = 0\n            tot += 1\n            if tot == 14:\n                return s[start:tot+start]\n    return \"\"\n\ndef two(start: int) -\u003e str:\n    arr: list[int] = [0] * 32\n    tot: int = 0\n    for i in range(len(b) - start):\n        d: int = b[start+i] % 32\n        if arr[d]:\n            return two(i+1)\n        \n        arr[d] = 1\n        tot += 1\n        if tot == 14:\n            return s[start:tot+start]\n    return \"\"\n\nst: float = time.time()\nprint(one(0))\nt1: float = time.time()-st\n\nst: float = time.time()\nprint(two(0))\nt2: float = time.time()-st\nprint(t2)\n\nprint(t1/t2)\n\n# two is 7x faster than one\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpsonresearch%2F14uniquechars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimpsonresearch%2F14uniquechars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpsonresearch%2F14uniquechars/lists"}