import java.util.*; class Solution { public int[] solution(int[] arr, boolean[] flag) { ArrayList list = new ArrayList (); for(int i = 0; i < flag.length; i++) { if(flag[i]) { for(int j = 0; j < arr[i] * 2; j++) { list.add(arr[i]); } }else { for(int j = 0; j < arr[i]; j++) { list.remove(list.size()-1); } } } int answer[] = new int [list.size()]; for(int i = 0; i < list.size(); i++) { answer[i] =..
class Solution { public String solution(String my_string, int s, int e) { String answer = ""; int idx = 0; String revStr = new StringBuilder(my_string.substring(s, e+1)).reverse().toString(); for(int i = 0; i = s && i
class Solution { public String solution(String my_string, int[] indices) { String answer = ""; String[] strArr = my_string.split(""); for(int idx : indices) { strArr[idx] = ""; } for(String str : strArr) { answer += str; } return answer; } }
class Solution { public int solution(int[] date1, int[] date2) { int answer = 0; for(int i = 0; i date2[i]) { break; } else if (date1[i] == date2[i]) { answer = 0; } else { answer = 1; } } return answer; } }
class Solution { public int[] solution(int[] arr, int[][] queries) { int[] answer = new int [arr.length]; for(int[] query : queries) { int num1 = query[0]; int num2 = query[1]; for(int i = 0; i = query[0] && i