Google onsite problem

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2024-12-22Added By Anonymous
Source: Link
🧭 Experience: unknown ✅ Outcome: unknown 💰 Compensation: unknown 📍 Location: unknown 🏢 Company: Google 🎓 Education: unknown 🎁 Benefits: unknown 📅 Offer Date: unknown

Given an array { 1, 7, 7, 2,3, 7, 6,-20}. Find the longest nondecreasing contiguous sequence with substitution. we can substitute any array element with any integer such as all occurrences of 7 replaced with 1. In this way new array would be { 1,1,1,2,3,1,6,-20}. here, the answer would be 5 from [1,1,1,2,3] Only one substitution is allowed.
Comments