/**
 * Given a string, find the first non-repeating character in it and return it's 
 * index. If it doesn't exist, return -1.
 *
 * Examples:
 *
 *  s = "leetcode"
 *  return 0.
 *
 *  s = "loveleetcode",
 *  return 2.
 * 
 * Note: You may assume the string contain only lowercase letters.
 *
 * Solution Reference:
 *  https://discuss.leetcode.com/topic/55148/java-7-lines-solution-29ms
 *
 * @param {string} s
 * @return {number}
 */
var firstUniqChar = function(s) {
    const occurances = [];
    const charCodeBase = 'a'.charCodeAt(0)
    
    // collect character occurances
    for (let i = 0; i < s.length; i++) {
	let position = s.charCodeAt(i) - charCodeBase;
        if (!occurances[position]) occurances[position] = 1
        else occurances[position]++;
    
    }
    // find the first unique character
    for (let i = 0; i < s.length; i++)
        if (occurances[s.charCodeAt(i) - charCodeBase] === 1) return i;
    
    return -1;
};

@@ -475,25 +475,26 @@
  const occur
-a
+re
 nces = %5B%5D;%0A 
@@ -679,25 +679,26 @@
   if (!occur
-a
+re
 nces%5Bpositio
@@ -702,25 +702,26 @@
 tion%5D) occur
-a
+re
 nces%5Bpositio
@@ -741,25 +741,26 @@
   else occur
-a
+re
 nces%5Bpositio
@@ -867,25 +867,26 @@
    if (occur
-a
+re
 nces%5Bs.charC

correct typo