Location: USA, Position: SWE Internship 2021 (Summer)
Gave an OA a few days ago, passed the round, and moving on to the phone interview round. Got 2 questions.
Q1. Variation of https://leetcode.com/discuss/interview-question/396769/
Problem setting was same with the link above, but the required output was the number of valid times given the input such as "??:??".
Test cases:
Input: "??:??"
Output: 1440
Input: "0?:14"
Output: 10Q2. Variation of https://leetcode.com/problems/longest-repeating-character-replacement/
Given an array consists of integers (ex. [1,2,3,1,2,3,3,3]), the required returning value is the length of longest substring that consists of repeating integer value you can get with maximum 3 replacements (and you can replace any item with any value).
Test cases:
Input: A = [1,2,3,1,2,3,3,3]
Output: 6
Replace A[1], A[3], A[4] with 3 (3 moves)
Input: A = [1,2,7,8,3,45]
Output: 4
Pick any item and replace 3 items adjacent to that item with the value of the picked item.I think I gave the correct answer for Q1, but for Q2, I was running out of time and couldn't give the finalized solution.
Any thoughts on Q2?