https://www.geeksforgeeks.org/amazon-interview-experience-for-software-development-engineer-ii/
Wednesday, 28 April 2021
Thursday, 15 April 2021
interview prog
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Tste extends BB {
public static void main(String[] args) {
System.out.println(solution("Sat", 15));
}
public static String solution(String s, int K) {
List<String> list = new ArrayList<String>();
String[] arr = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
list = Arrays.asList(arr);
int cuurtInd = list.indexOf(s);
String result = "";
if (K <= 0) {
return arr[0];
} else {
int div = K / arr.length;
int reminder = K % arr.length;
System.out.println(cuurtInd);
System.out.println(div);
System.out.println(reminder);
if (cuurtInd + reminder >= arr.length) {
int temp = (cuurtInd + reminder) % arr.length;
result = list.get(temp);
} else
result = list.get(cuurtInd + reminder);
}
return result;
}
}