{"id":22513844,"url":"https://github.com/emahtab/first-unique-character-in-a-string","last_synced_at":"2026-02-06T16:07:49.121Z","repository":{"id":79525495,"uuid":"245830398","full_name":"eMahtab/first-unique-character-in-a-string","owner":"eMahtab","description":"Find the first unique character in a string","archived":false,"fork":false,"pushed_at":"2020-03-08T14:37:14.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T15:07:23.035Z","etag":null,"topics":["hashmap","leetcode","problem-solving"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eMahtab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-03-08T14:35:06.000Z","updated_at":"2020-03-08T14:38:00.000Z","dependencies_parsed_at":"2023-05-10T17:16:01.156Z","dependency_job_id":null,"html_url":"https://github.com/eMahtab/first-unique-character-in-a-string","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eMahtab/first-unique-character-in-a-string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffirst-unique-character-in-a-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffirst-unique-character-in-a-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffirst-unique-character-in-a-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffirst-unique-character-in-a-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eMahtab","download_url":"https://codeload.github.com/eMahtab/first-unique-character-in-a-string/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Ffirst-unique-character-in-a-string/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29167871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T15:38:29.831Z","status":"ssl_error","status_checked_at":"2026-02-06T15:37:48.592Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hashmap","leetcode","problem-solving"],"created_at":"2024-12-07T03:14:38.501Z","updated_at":"2026-02-06T16:07:49.094Z","avatar_url":"https://github.com/eMahtab.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# First unique character in a string\n## https://leetcode.com/problems/first-unique-character-in-a-string\n\nGiven a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.\n```\nExamples:\n\ns = \"leetcode\"\nreturn 0.\n\ns = \"loveleetcode\",\nreturn 2.\n```\n**Note: You may assume the string contain only lowercase letters.**\n\n# Implementation :\n\n```java\nclass Solution {\n    public int firstUniqChar(String s) {\n        HashMap\u003cCharacter, Integer\u003e count = new HashMap\u003cCharacter, Integer\u003e();\n        int n = s.length();\n        // build hash map : character and how often it appears\n        for (int i = 0; i \u003c n; i++) {\n            char c = s.charAt(i);\n            count.put(c, count.getOrDefault(c, 0) + 1);\n        }\n        \n        // find the index\n        for (int i = 0; i \u003c n; i++) {\n            if (count.get(s.charAt(i)) == 1) \n                return i;\n        }\n        return -1;\n    }\n}\n```\n\n# References :\nhttps://leetcode.com/articles/first-unique-character-in-a-string\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Ffirst-unique-character-in-a-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femahtab%2Ffirst-unique-character-in-a-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Ffirst-unique-character-in-a-string/lists"}