谷歌实习OA

90分钟2题

Question 1
Given a time (24 hours format) with missing digits marked as ‘?’. Return the latest possible time.
Examples:
??:?? ==> 23:59
12:23 ==> 12:23
1?:43 ==> 19:43

public static String solution(String T){
// implement your solution here

}

Question 2
Array X is greater than Array Y if the first non-matching element in both arrays has a greater value in X than in Y.

X = [1, 3]
Y = [1, 2]

Given an array A with N integers and an Integer K, return the largest contiguous subarray of length K from all contiguous subarray of length K.

Example:
A = [1, 4, 3, 2, 5], K = 4
return
[4, 3, 2, 5]

public static Integer[] solution(Integer[] N, int K){

}

第一题你的解题思路是什么?能否分享一下
第二题在这里有讨论:https://leetcode.com/discuss/interview-question/352459/

收到电面了吗