Last active
August 21, 2020 08:35
-
-
Save yungyungGwon/4f72a1f72f4e344c539aa8379240f812 to your computer and use it in GitHub Desktop.
Algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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