
public class Solution
{
public int[] solution(string[] intStrs, int k, int s, int l)
{
int[] answer = new int[intStrs.Length];
for(int i = 0; i < intStrs.Length; i++)
{
answer[i] = int.Parse(intStrs[i].Substring(s, l));
}
var answer2 = answer.Where(se => se > k).ToArray();
return answer2;
}
}
using System;
using System.Linq;
public class Solution {
public int[] solution(string[] intStrs, int k, int s, int l)
{
return intStrs.Select(e => int.Parse(e.Substring(s, l)))
.Where(w => w > k).ToArray();
}
}
Linq 기능으로 뭘 더 할 수 있지 않았을까 했는데 역시 다른 사람의 풀이를 보니 Linq로 깔끔하게 작성되어 있었다. select 기능을 좀 더 연습해봐야겠다.