旧金山大学USF MSCS项目 25Fall 面试后更新贴
2480
楼主是申请的是CS项目,而不是CS Bridge项目。面试整体难度在leetcode easy,重点考察的是基础,面试共22分钟,包含前面面试官问为什么申请USF,以及开始coding,coding部分2个题,都是Array。面试时间一共22分钟,以下是coding题目的答案,面试官会给说要求什么是output,什么是input,只用写methods:
题目1:public static boolean sortedArr(int[] arr) {
boolean ascend = true;
boolean descend = true;
for (int i =1; i < arr.length; i++) {
if (arr[i] > arr[i-1]) {
descend = false;
}
if (arr[i] < arr[i-1]) {
ascend = false;
}
}
return ascend || descend;
}
题目2:public static int[] sortOutcome(int[] arr1, int[] arr2) {
int length = arr1.length + arr2.length;
int[] newArray = new int[length];
int i = 0;
int j = 0;
int m = 0;
while(i < arr1.length && j < arr2.length) {
if (arr1[i] <= arr2[j]) {
newArray[m++] = arr1[i++];
} else {
newArray[m++] = arr2[j++];
}
}
while(i < arr1.length) {
newArray[m++] = arr1[i++];
}
while(j < arr2.length) {
newArray[m++] = arr2[j++];
}
return newArray;
}
题目1:public static boolean sortedArr(int[] arr) {
boolean ascend = true;
boolean descend = true;
for (int i =1; i < arr.length; i++) {
if (arr[i] > arr[i-1]) {
descend = false;
}
if (arr[i] < arr[i-1]) {
ascend = false;
}
}
return ascend || descend;
}
题目2:public static int[] sortOutcome(int[] arr1, int[] arr2) {
int length = arr1.length + arr2.length;
int[] newArray = new int[length];
int i = 0;
int j = 0;
int m = 0;
while(i < arr1.length && j < arr2.length) {
if (arr1[i] <= arr2[j]) {
newArray[m++] = arr1[i++];
} else {
newArray[m++] = arr2[j++];
}
}
while(i < arr1.length) {
newArray[m++] = arr1[i++];
}
while(j < arr2.length) {
newArray[m++] = arr2[j++];
}
return newArray;
}
0条回复