Latest Google SWE Intern OA Experience Review | ProgranHelp students 30 minutes 2 questions high score details

985 Views

Just finished helping a trainee 26 Google SWE Intern OA interview, the question type is still two coding, the difficulty is a little different from TikTok, Google's difficulty has increased a little bit, the two questions are medium to the top, before more biased conventional data structure questions, this year more emphasis on graph algprithm and deformation of the question, the OA questions to share to want to cast Google's I would like to share this OA question with those who want to vote for Google for reference.

Latest Google SWE Intern OA Experience Review | ProgranHelp students 30 minutes 2 questions high score details

Question 1 Dynamic Programming

Problem 1.

Given a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward.

Solution: You can use the center expansion method or dynamic programming. The idea of center expansion method is to check the echo by expanding it in both directions with each character (or between two characters) as the center. The idea of dynamic programming is to use dp[i][j] to indicate whether the substring from position i to position j is an echo. The time complexity of the center expansion method is 0(n2) ,the space complexity is 0(1) ,which is relatively better.

Problem 2.

You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. How many distinct ways can you climb to the top?

Solution: This is the classic stair climbing problem, where dp[i] denotes the number of ways to get to step i. The recurrence relation is dp[i] = dp[i-1] + dp[i-2] . The recurrence relation is dp[i] = dp[i-1] + dp[i-2] .
The base case is dp[0]=1,dp[1]=1. You can use the bottom-up approach, or optimize the space complexity by using only two variables. But Google's version usually has changes, such as being able to climb 1, 2, 3 steps, or not being able to step on certain steps.

Question 2 Tree and Graph

Problem 3.

Given the root of a binary tree, return the aximum path sum of any non-empty path. A path is defined as a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them.

Solution: Use the idea of recursion. For each node, compute the maximum sum of paths that can be provided by the subtree rooted at that node. There are four cases to consider: current node only, current node plus left subtree, current node plus right subtree, and current node plus left and right subtrees. The key point of this question is to distinguish between two concepts: the maximum sum of paths down to the current node (which can be returned to the parent node), and the maximum sum of paths through the current node.

Problem 4.

There are a total of numCourses courses you have to take, labeled from o to numCourses- 1. You are given an array prerequisites where prerequisites[i] = [ai You are given an array prerequisites where prerequisites[i] = [ai] , bil indicates that you must take course bi first iï you want to take course ai. Return true if you can finish all courses. Otherwise, return false.

Solution: This is a Course Schedule problem, which essentially detects the presence of a ring in a directed graph. Rings are detected using topological sorting or DFS. The topological sorting method maintains the in-degree of each node and removes nodes with in-degree of 0 each time, if all nodes are eventually removed then there is no ring.The DFS method labels the nodes with three states: unvisited, visited, visited, if a node that is being visited is encountered in the DFS process then there is a ring.

Summarize

  • Google SWE Intern OA questions are characterized by not pursuing difficult problems, but focusing on the ability to disassemble the problem, and the questions are generally medium to hard level.
  • Preparing for Google SWE Intern OA should brush up on LeetCode, especially Google tag topics, for realistic practice, mock OA, practice writing bug-free code quickly under time pressure.

Afraid that you won't pass the Google SWE Intern OA?

The reason why this student was able to pass the exams and get the interview offer is because Programhelp The real-time voice assistants intervene the moment they get stuck in their thinking - not by giving direct answers, but by guiding them to build clear, robust, Google-compliant code logic on their own.

If you're also targeting SWE internships at top companies like Google, Meta, Apple, etc., Programhelp offers you Provide professional remote voice assistance, OA ghostwriting, and mock interview jurying to ensure that your technical depth translates into a convincing interview performance in a high-pressure OA environment, 100%!

author avatar
Alex Ma Staff Software Engineer
Currently working at Google, with more than 10 years of development experience, currently serving as Senior Solution Architect. He has a bachelor's degree in computer science from Peking University and is good at various algorithms, Java, C++ and other programming languages. While in school, he participated in many competitions such as ACM and Tianchi Big Data, and owned a number of top papers and patents.
END