Has anyone completed the OA for SWE internship at Google recently? I feel so stressed and I really want to do well. Please lmk if you have any advice!
Hello. Here’s an example of a recent OA:
- You are given an array of integers. Your task is to create pairs of them, such that every created pair has the same sum. This sum is not specified, but the number of created pairs should be the maximum possible. Each array element may belong to one pair only. class Solution {public int solution(int)[] A};} that given an array A consisting of N integers, returns the maximum possible number of pairs with the same sum.
Example: A=[1,9,8,100,2], return 2 (A[0],A[1]) and (A[2],A[4])
A=[2,2,2,3], return 1
A=[5,5], return 1 - Write a function class Solution {public String solution (String S);} which, given a string S consisting of lowercase letters of the English alphabet, returns the longest consistent fragment of S which begins and ends with the same letter. If there are many possible answers you should return the one starting at the earliest position.
Example: S=“cbaabaab”, return “baabaab”
S=“performance”, return “erformance”
S=“cat”, return “c”
Good luck, hope this helps!