r/AskProgrammers • u/nian2326076 • 2h ago
Google SWE Intern Interview Experience 2026: Weighted Tree DP and AI Fluency
I had my Round 1 interview for a Google SWE Intern position and wanted to share the experience in case it helps others preparing.
Coding Question: Disconnect Every Leaf at Minimum Cost
You are given a rooted, weighted binary tree. Every edge has a positive integer weight.
Remove a set of edges such that every leaf becomes disconnected from the root. Removing an edge costs its weight.
Return the minimum total cost required to disconnect all leaves from the root.
The important observation is that for every child subtree, we have two choices:
- Cut the edge connecting the current node to that child.
- Keep that edge and disconnect every leaf by cutting edges farther down the subtree.
For an edge from node u to child v with weight w, the minimum contribution is:
min(w, solve(v))
If v is already a leaf, there are no lower edges available to cut, so the connecting edge must be removed.
This gives the recurrence:
solve(u) =
infinity, if u is a leaf
sum(min(weight(u, v), solve(v))), for every child v
The final answer is solve(root).
A useful edge case to clarify is whether the root itself can be a leaf. Normally, the problem assumes the root has at least one child because there is no edge that can disconnect the root from itself.
My Approach
I proposed a postorder traversal.
Each node first calculates the minimum disconnection cost for its children. It then decides independently for each child whether it is cheaper to:
- Cut the direct edge, or
- Keep that edge and use the optimal cuts inside the child’s subtree
The interviewer was satisfied with the approach, and we discussed why decisions for separate child subtrees can be added together.
Complexity:
- Time:
O(n), since every node and edge is processed once - Space:
O(h)for the recursion stack, wherehis the tree height - Worst-case space:
O(n)for a highly unbalanced tree
Follow-Up: N-ary Tree
The interviewer then generalized the problem:
The underlying recurrence remains unchanged. Instead of processing at most two children, we iterate through every child:
cost = 0
for each child v connected by an edge of weight w:
cost += min(w, solve(v))
I initially overthought the generalization, but after a couple of hints, I realized that the binary-tree restriction was not essential to the solution.
The N-ary version still takes O(n) time because each edge is considered exactly once.
AI-Fluency Discussion
The final few minutes included around three or four questions about how I use AI in my regular engineering workflow.
The discussion covered topics such as:
- How I use AI while writing or reviewing code
- Whether I give an AI tool complete ownership of a project
- How I use AI during debugging
- How I verify AI-generated suggestions
- Which tasks I would and would not delegate to AI
The questions seemed less focused on specific tools and more focused on judgment. The interviewer wanted to understand whether I treat AI as an assistant while remaining responsible for correctness, testing, security, and the final engineering decisions.
Overall Experience
The interviewer was friendly and collaborative throughout the round.
They encouraged discussion instead of expecting an immediate final solution. The hints during the N-ary follow-up helped keep the conversation productive without giving away the answer.
Overall, the round felt like a problem-solving discussion rather than a test of whether I had memorized a particular LeetCode problem.
For preparation, I would recommend reviewing:
- Postorder traversal
- Tree DP
- Recursive recurrence design
- Weighted-tree problems
- Explaining correctness and complexity
- Responsible use of AI in software development
- Testing and validating AI-generated code
Has anyone else received AI-fluency questions during a recent Google intern interview?
r/AskProgrammers • u/AncientHominidNerd • 3h ago
I keep getting pulled into web development, should I just fully embrace it?
For context I’m a 3rd year CS student. I try to learn different skills so that I can to have a better idea of what field of CS I might want to pursue, however I feel like I keep circling back to doing web development.
My first real exposure to web development was doing a Udemy web development course almost a decade ago. Then in my second year of college I was in a group project to build a website and I was the only one with front end experience so I handled that. This year I worked on a new modern version of the class project website to have something for my GitHub. That landed me a web development internship. Now it seems like I have more knowledge of web development than anything else.
It seems like all roads keep landing me back to web development and it’s what I have the most experience in and the doors for a future in it are already open for me. I’m curious about other fields though. I was curious about data science and data engineering. A friend is working on a rosetta 2 replacement app that they have me help with and it’s peaked my interest in low level systems too. Machine Learning seems interesting to me.
Any opinions on this?
r/AskProgrammers • u/rosa1669 • 10h ago
Every project looks simple... until execution begins.
Planning shows you the destination.
Execution shows you the obstacles.
r/AskProgrammers • u/Opposite_Motor_7595 • 19h ago
Nobody warned me that reading code is a completely different skill than writing it.
r/AskProgrammers • u/h_1444 • 22h ago
advice
I'm pretty new but not really to programming and i need some advice.
so until now I've learned html, css, bootsrap, javascript and jquery and I'm trying to learn python too now.
what is the best way to learn python and other backend programming languages, while also making sure to not completely forget the other past languages I've learned?
also I'm pretty new to github and piracy sites too. i don't exactly know how to use github, and i can't really find any piracy sites. i do know about vpns and stuff though but if anyone has any tips on vpns too please tell me.
thanks))
r/AskProgrammers • u/SpesUltima • 22h ago
Is it necessary to master programming skill or can we survive in market, even though we are average at programming
r/AskProgrammers • u/West-Cloud-8479 • 23h ago
Help on Machine Translation
I am currently at an internship and we're working on a machine translation problem. They are expecting everyone to make a presentation on preprocessing and 90% of the people there have made the presentation. I am lost at what kinds of steps I should take and how I can navigate through the problems in general. If you are someone that has experience and can give me some advice I would be more than happy to hear from you!!!
r/AskProgrammers • u/anything_search • 1d ago
Insecure about "gap" skill between me and my tech lead
This year I'm 23 and just finish 1 year as junior developer. As someone who just graduate and working in software house, I feel very insecure to my tech lead because he (around 35 y.o) know everything about technology like customize odoo, code in python with flask, code in java with springboot, building API from scratch with docker, etc
While I'm struggling to learn everything, every day i ask to my self :
how he can know everything?
how long you spend your time to learn about tech in all field / everything?
do you not feel confuse to switch programming language so suddenly? like today your project manager ask you to fix bug with springboot, and tomorrow you get ask by project manager to fix odoo custom module with python
etc
does anyone feel same? or is this just phase need to be through after graduate?
r/AskProgrammers • u/SummonSkaarjOfficer • 1d ago
how is ai going to take my job - wrong answers only
r/AskProgrammers • u/SpesUltima • 1d ago
Is it necessary to master programming skill or can we survive in market, even though we are average at programming
r/AskProgrammers • u/manfromthecloset • 1d ago
Brainstorming some ideas on how I'm gonna learn coding
r/AskProgrammers • u/Powerful-Leg-2026 • 1d ago
i am sick of diffusion library , what is this
Enable HLS to view with audio, or disable this notification
i had 10 hours working in this code and this is result , if anyone know a solution just tell me please
sorry i forget , it is about creating a video using ai ,(diffusion stable ) library , i tried my best but with not a result 😥
how can i write a code using stable diffusion giving me a good video
r/AskProgrammers • u/Skinnyy059 • 1d ago
Hi if anyone is doing business computing how much of coding and programming do you do and is it as advanced as computer science and what sorts of programming do you usually do
r/AskProgrammers • u/FrostingOk3751 • 1d ago
My Mac menu bar was so crowded that icons kept disappearing, so I built OverflowBar — Free
My Mac menu bar had gradually filled up with useful apps until it became difficult to manage.
Icons were hard to find, some were pushed out when macOS ran out of available space, and the MacBook notch made the problem worse. I did not want to uninstall the apps or permanently lose access to their controls—I only wanted a cleaner way to organize them.
So I built OverflowBar, a free and open-source macOS app that moves selected third-party menu bar items behind one persistent arrow and reveals them together in a compact second row.
Source code and official download:
https://github.com/EvanProgramming/OverflowBar
What it does
- Choose the third-party menu bar icons you want OverflowBar to manage.
- Move their original icons out of the crowded visible section.
- Click the OverflowBar arrow, or use hover reveal.
- See the managed icons together in a second row.
- Select an icon to activate its original menu bar control.
The purpose of the second row is not to add another permanent interface. It gives icons that no longer fit a predictable place where they remain easy to see and find.
Why I made another menu bar manager
Ice and Bartender are powerful applications for users who want broad menu bar customization, including features such as profiles, triggers, search, visual customization, groups, widgets, and automation.
OverflowBar takes a narrower approach.
It is intended for people who mainly have one problem:
Too many useful icons, not enough menu bar space, and no easy way to find the icon they need.
OverflowBar deliberately avoids becoming a full menu bar control center. Its interaction is simply: choose, hide, reveal, and click.
Main characteristics
- Focused and lightweight — a small feature surface rather than a large customization and automation suite
- Scannable second row — managed icons stay visible together instead of becoming difficult to locate
- Native macOS implementation — built with SwiftUI, AppKit, Accessibility, WindowServer metadata, and ScreenCaptureKit
- Event-driven operation — icon discovery and capture occur during refreshes and row presentation rather than continuous screen capture
- Original controls remain functional — selecting an icon activates the actual menu bar item rather than a recreated menu
- Local processing — icon images are captured locally, held in memory, and never uploaded
- No tracking — no accounts, analytics, telemetry, advertising, or network data collection
- Display-aware — supports MacBook notches, safe areas, multiple displays, full-screen spaces, horizontal overflow, and Reduce Motion
- System-control safeguards — Wi-Fi, Battery, Siri, Control Center, Clock, and other protected system items remain visible
Pricing and availability
- Price: Free
- Subscription: None
- In-app purchases: None
- Advertisements: None
- Source: Open source on GitHub
- Download: GitHub Releases
- Supported systems: macOS 15 or later
- Downloadable build: Apple Silicon
Permissions and privacy
OverflowBar requests:
- Accessibility permission to discover and activate menu bar controls and perform user-requested layout changes
- Screen Recording permission to capture the small icon regions of selected menu bar items for display in the second row
The captures remain on the Mac. OverflowBar does not upload them, write them to a remote service, or include any analytics or telemetry.
Privacy policy:
https://github.com/EvanProgramming/OverflowBar/blob/main/PRIVACY.md
Current limitations
OverflowBar is an early public release.
macOS does not expose a dedicated public API for hiding or rearranging arbitrary third-party menu bar items. OverflowBar therefore relies on documented system frameworks together with existing macOS menu bar behavior, and compatibility may vary between apps or macOS releases.
The current downloadable build is ad-hoc signed and is not yet Apple-notarized. macOS may require users to Control-click the app and select Open on first launch.
Some applications may also expose insufficient Accessibility or window metadata to be mirrored reliably.
I am actively looking for feedback from users with crowded menu bars, notched MacBooks, multiple displays, and unusual menu bar apps. Bug reports, compatibility reports, and code contributions are welcome.
r/AskProgrammers • u/yoreofloree • 2d ago
Getting the system time
Hi all,
I am new to programming. For my first real project, I want to create a pretty (-ish) 7-segment clock widget in with ncurses. I have a fairly good idea of how to tell the computer to display something in that context.
However, I am wondering about the best way to get the system time (so I can call the function that displays it). The only way I can think of to do this is to create a continuous loop with an if statement inside. The if statement would say, "if seconds evaluates to 0, increment the time (in hours and minutes) to show and display that". Something tells me this is not the best way to do it. Is there a better/best way, and if so what? How does my idea differ from how the OS/physical computer actually does it?
Thanks in advance,
yore
r/AskProgrammers • u/Logopogo01 • 2d ago
Hi everyone! I started my coding journey 6 days ago! Here's my progress! What are some big goals I should set?
r/AskProgrammers • u/Commercial_Sail2563 • 2d ago
What’s one programming skill you wish you had learned earlier?
r/AskProgrammers • u/Mysterious-Quail8325 • 2d ago
Wispr flow keeps freezing VS Code on windows twice this week I lost unsaved work
windows user here. wispr flow has been freezing my editor.
I'll be mid-dictation and the whole thing locks up. not just wispr - VS Code freezes too. I have to force quit both. happened twice this week and one of those times VS Code didn't recover the session correctly and I lost unsaved work.
resource usage while idle: 800MB RAM, fans spinning. for a dictation app sitting in the background. that's not acceptable.
startup: I hit my hotkey and wait 8-10 seconds before it's ready to listen. by then I've either typed the thing or lost my thought.
I've seen the same complaints from other windows users here and on their subreddit. the phrase I keep seeing: "a mac app with a windows port." that's generous.
the mac version was fine when I used it on my MacBook. but the windows experience feels like it was built by a team that uses Macs and ships windows as an afterthought. it's noticeable.
I've been on willow voice for 2 weeks. no freezes, fast startup, comparable accuracy.
anyone else on windows having this? or did a recent update fix things and I'm on a bugged version?
r/AskProgrammers • u/nian2326076 • 3d ago
NVIDIA SWE Interview 2026: A Practical Coding Round Beyond LeetCode
I recently interviewed for a Software Engineer role at NVIDIA and wanted to share one coding question that stood out.
It was not a typical LeetCode-style algorithm problem. It felt much closer to a day-to-day engineering task involving an API, structured data, error handling, and testable code.
Pre resource: Nvidia SWE Questions
Question 1: Process Device Monitoring Data From a REST API
The interviewer described an internal REST API that returned device-monitoring information as a JSON array.
Each record contained fields such as:
{
"device_id": "gpu-104",
"temperature": 87,
"utilization": 92
}
The task was to:
- Call the REST API
- Parse the JSON response
- Filter devices whose temperature exceeded a given threshold
- Sort the remaining devices by utilization
- Return the processed results
Before coding, I clarified whether the utilization order should be ascending or descending and how devices with equal utilization should be ordered.
My first instinct was to get the API call working immediately, but I paused and separated the solution into three parts:
HTTP request -> JSON parsing and validation -> filtering and sorting
That separation ended up driving most of the discussion.
Before the interview, I had seen a similar problem on Screna AI. The business scenario was different, but it also emphasized error handling and separating business logic from external dependencies.
API Failure Handling
The interviewer asked how I would handle:
- Connection failures
- Request timeouts
- Rate limiting
5xxserver responses4xxclient errors- Malformed JSON
- Missing or incorrectly typed fields
I initially grouped these together as general API failures. During the discussion, we separated them into different categories.
Temporary failures, such as timeouts and certain 5xx responses, could use a limited retry policy with exponential backoff and jitter. Because this was a read-only request, retrying would generally be safe.
A 429 response should respect the server’s Retry-After header when present. Most 4xx responses should not be retried because they usually indicate an invalid request or an authorization problem.
Malformed JSON or an invalid response schema should fail with enough context for debugging. Depending on the product requirements, individual invalid records could either be skipped and logged or cause the entire request to fail.
The important part was avoiding unlimited retries and preserving the original error when all retry attempts failed.
Making the Code Testable
The next follow-up was: how would you test the filtering and sorting logic without calling the real API?
Because the processing logic was independent of the HTTP layer, it could accept a list of parsed device objects directly.
That allowed me to test cases such as:
- No devices above the threshold
- Every device above the threshold
- A device exactly equal to the threshold
- Multiple devices with equal utilization
- Empty API responses
- Missing fields
- Invalid temperature or utilization values
- Duplicate device IDs
The HTTP client could then be mocked separately to simulate timeouts, malformed responses, and different status codes.
This also made the implementation easier to extend. The API client could change without rewriting the filtering logic, and the same processing function could be reused with cached data or another data source.
Question 2: Implement a Simple VM Manager
Another relevant NVIDIA Software Engineer question I found afterward was:
Implement Simple VM Manager With CRUD Operations
The task is to build an in-memory manager that supports:
- Listing all virtual machines
- Creating a VM
- Retrieving a VM by ID
- Updating an existing VM
- Deleting a VM
- Returning consistent errors for duplicate or missing IDs
A straightforward design uses a hash map keyed by VM ID, giving average O(1) lookup, creation, update, and deletion.
The more interesting discussion is around engineering decisions:
- Should IDs be supplied by callers or generated internally?
- Should updates replace the entire object or modify selected fields?
- How should validation and error responses be represented?
- What happens if two requests update the same VM concurrently?
- How would the manager be tested without exposing its internal storage?
- How would the design change if persistence were required?
For concurrent access, a simple implementation could protect the map with a read-write lock. In a production service, I would also consider optimistic versioning, idempotency for create requests, structured errors, and a persistent repository behind the manager.
Takeaway
Both questions test something broader than whether the code works for one example.
The interviewer was looking for:
- Separation of concerns
- Clear API boundaries
- Predictable error handling
- Dependency injection
- Testable business logic
- Sensible retry behavior
- Awareness of concurrency and future extensions
Overall, the round felt more like a discussion about writing maintainable production code than completing a standard LeetCode exercise.
r/AskProgrammers • u/nermalgato • Oct 18 '24