
class Solution {
public long[] solution(int x, int n) {
long[] answer = new long[n];
long cur = x;
for(int i = 0 ; i < n ; i++){
answer[i] = cur;
cur += x;
}
return answer;
}
}
import java.util.*;
class Solution {
public int[] solution(long n) {
ArrayList<Integer> list = new ArrayList<>();
while(n > 0){
list.add((int)(n % 10));
n /= 10;
}
int[] answer = new int[list.size()];
for(int i = 0 ; i < list.size() ; i++){
answer[i] = list.get(i);
}
return answer;
}
}
class Solution {
public int solution(String s) {
if(s.charAt(0) == '-'){
return -1 * Integer.parseInt(s.substring(1));
}else{
return Integer.parseInt(s);
}
}
}
class Solution {
public long solution(long n) {
double root = Math.sqrt(n);
long root_int = (long)root;
if(root != root_int){
return -1;
}
return (long)Math.pow(root_int + 1, 2);
}
}
import java.util.*;
class Solution {
public long solution(long n) {
ArrayList<Long> list = new ArrayList<>();
while(n > 0){
list.add(n % 10);
n /= 10;
}
Collections.sort(list, Comparator.reverseOrder());
long answer = 0;
for(long cur : list){
answer = (answer + cur) * 10;
}
answer /= 10;
return answer;
}
}