精華區beta Marginalman 關於我們 聯絡資訊
※ 引述 《JerryChungYC (JerryChung)》 之銘言: :   : https://leetcode.com/problems/first-unique-character-in-a-string :   : 387. First Unique Character in a String :   : 給一個字串s,找到第一個不重複的字元回傳其索引,不存在則回傳-1 :   : Example 1: : Input: s = "leetcode" : Output: 0 :   : Example 2: : Input: s = "loveleetcode" : Outpue: 2 :   : Example 3: : Input: s = "aabb" : Output: -1 :   這題我只想到 第一個for迴圈建unordered_map 第二個for迴圈找第一個key的value為1的 還有別的解法嗎 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.76.31.200 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1707095729.A.F69.html