// Given an array of size N, and a number K, find the Kth most common element in an array.

// Example:
// [1,2,2,3,3,4,4,4], 4 => 1




function common(arr, k){
  var freqHash = {},
      storage = [];

  for(var i = 0; i < arr.length; i++){
    if (freqHash[arr[i]] === undefined){
      freqHash[arr[i]] = 1;
    }
    else{
      freqHash[arr[i]] += 1;
    }
  }
  for(var key in freqHash){
    storage.push(key);
  }
  storage = storage.sort(function(a,b){return b - a});
  return storage[k-1];
}

@@ -128,16 +128,514 @@
  =%3E 1%0A%0A%0A
+// Logic%0A%0A// create a freqhash to keep the track of how many times an elemnt occurs%0A// the freqHash wil have the element as the key, and the number of occurance as the value%0A// loop through the given array%0A  // if the key isnt asigned yet set the value to one for its first occurance%0A  // else add one to the value%0A// loop through the freqhash and push each key into the storage array%0A// sort out the storage arr in descending order%0A// return the kth element - 1 to find the kth most common element
 %0A%0Afuncti

add logic