
😎풀이
s 문자열을 :을 기준으로 분리
- 열에 해당하는 알파벳을 숫자형으로 형변환
- 열 순회
3-1. 행 순회
3-2. 현재 행렬을 연결하여 포함된 셀 배열에 추가
- 선택된 셀 목록 반환
function cellsInRange(s: string): string[] {
const [startPos, endPos] = s.split(":")
const [sc, sr] = startPos.split("")
const [ec, er] = endPos.split("")
const numStartCol = sc.charCodeAt(0)
const numEndCol = ec.charCodeAt(0)
const numStartRow = Number(sr)
const numEndRow = Number(er)
const listOfCell = []
for(let col = numStartCol; col <= numEndCol; col++) {
const curColAlphabet = String.fromCharCode(col)
for(let row = numStartRow; row <= numEndRow; row++) {
listOfCell.push(curColAlphabet + row)
}
}
return listOfCell
};