Skip to content

Instantly share code, notes, and snippets.

@yungyungGwon
Last active August 21, 2020 08:35
Show Gist options
  • Save yungyungGwon/4f72a1f72f4e344c539aa8379240f812 to your computer and use it in GitHub Desktop.
Save yungyungGwon/4f72a1f72f4e344c539aa8379240f812 to your computer and use it in GitHub Desktop.
Algorithm
function solution(arr){
var min = arr[0];
var idx = 0;
for(var i = 1; i < arr.length; i++){
if(min > arr[i]){
min = arr[i];
idx = i;
}
}
arr.splice(idx,1);
if(arr == ""){
return [-1];
}
return arr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment