public long solution(int a, int b) { int start = Math.min(a, b); int end = Math.max(a, b); return IntStream.rangeClosed(start, end).asLongStream().sum(); }
출처:https://school.programmers.co.kr/learn/courses/30/lessons/12912