[Algorithm] 5 week(2.7 ~ 13) 2/3

Dev_min·2022년 2월 9일
0

algorithm

목록 보기
14/157

2089. Find Target Indices After Sorting Array

var targetIndices = function(nums, target) {
    const sortedNums = nums.sort((a, b) => a - b);
    const result = []
    sortedNums.forEach((nums, index) => {
        if(nums === target){
            result.push(index);
        }
    })
    
    return result;
};
profile
TIL record

0개의 댓글