Coding Round Expectations (Senior Level)

šŸ“– Concept

Google's coding rounds at the senior level test not just your ability to solve problems, but your engineering maturity. You're expected to write production-quality code, discuss trade-offs, and optimize proactively.

What interviewers evaluate:

  1. Problem Decomposition — Can you break a complex problem into smaller, manageable parts?
  2. Algorithm Selection — Do you choose the right data structure/algorithm and explain WHY?
  3. Code Quality — Clean, readable, idiomatic Kotlin. No spaghetti code.
  4. Edge Cases — Do you identify and handle them without being prompted?
  5. Complexity Analysis — Time and space analysis BEFORE and AFTER optimization.
  6. Communication — Do you think aloud, ask clarifying questions, and explain trade-offs?

Senior-level expectations vs mid-level:

  • Mid-level: Solve the problem correctly with some hints
  • Senior: Solve optimally, drive the conversation, identify edge cases unprompted, discuss alternative approaches and their trade-offs

Problem difficulty: Typically LeetCode Medium to Hard. Common categories:

  • Arrays/Strings — Two pointers, sliding window, prefix sums
  • Trees/Graphs — BFS/DFS, topological sort, shortest path
  • Dynamic Programming — State transitions, optimization
  • Hash Maps — Frequency counting, caching patterns
  • System-oriented — Design an iterator, implement a data structure

The coding workflow Google expects:

1. Clarify requirements (2 min)
2. Discuss approach & complexity (3 min)
3. Code the solution (20 min)
4. Test with examples (5 min)
5. Optimize if needed (10 min)
6. Discuss edge cases (5 min)

Critical tip: Google interviewers write detailed feedback. They note whether you needed hints, how many, and at what stage. Senior candidates should need zero to one hints maximum.

šŸ’» Code Example

codeTap to expand ā›¶
1// Example: Google-style coding problem
2// "Find the length of the longest substring without repeating characters"
3// This is a classic sliding window problem
4
5// Approach 1: Brute force — O(n³) āŒ Not acceptable at senior level
6fun lengthOfLongestSubstringBrute(s: String): Int {
7 var maxLen = 0
8 for (i in s.indices) {
9 for (j in i until s.length) {
10 val sub = s.substring(i, j + 1)
11 if (sub.toSet().size == sub.length) {
12 maxLen = maxOf(maxLen, sub.length)
13 }
14 }
15 }
16 return maxLen
17}
18
19// Approach 2: Sliding window with HashSet — O(n) āœ… Expected at senior level
20fun lengthOfLongestSubstring(s: String): Int {
21 val charIndex = mutableMapOf<Char, Int>()
22 var maxLen = 0
23 var left = 0
24
25 for (right in s.indices) {
26 val c = s[right]
27 // If char was seen and is within current window, shrink window
28 if (c in charIndex && charIndex[c]!! >= left) {
29 left = charIndex[c]!! + 1
30 }
31 charIndex[c] = right
32 maxLen = maxOf(maxLen, right - left + 1)
33 }
34 return maxLen
35}
36
37// How a senior candidate walks through this:
38// 1. "I'll use a sliding window with a map tracking last seen index of each char"
39// 2. "Time: O(n) — single pass. Space: O(min(n, charset)) — map of unique chars"
40// 3. "Edge cases: empty string, all same chars, all unique chars"
41// 4. Tests:
42// "abcabcbb" → 3 ("abc")
43// "bbbbb" → 1 ("b")
44// "pwwkew" → 3 ("wke")
45// "" → 0
46
47// Google expects Kotlin idioms, not Java-style Kotlin:
48// āœ… val, data classes, extension functions, scope functions
49// āŒ var everywhere, manual null checks, verbose Java patterns

šŸ‹ļø Practice Exercise

Practice Problems (Google Frequency):

  1. Two Sum — HashMap approach, O(n)
  2. Merge Intervals — Sorting + greedy
  3. LRU Cache — LinkedHashMap or manual doubly-linked list + map
  4. Word Break — DP with Trie optimization
  5. Serialize/Deserialize Binary Tree — BFS or preorder
  6. Minimum Window Substring — Sliding window
  7. Course Schedule — Topological sort
  8. Median of Two Sorted Arrays — Binary search, O(log(m+n))
  9. Trapping Rain Water — Two pointer or stack
  10. Design Hit Counter — Queue or circular buffer

Meta Practice:

  • Solve each problem first, then re-solve it while narrating your thought process aloud
  • Time yourself: 35 minutes maximum per problem
  • Write on a plain text editor, no autocomplete
  • After solving, write out the complexity analysis
  • Identify at least 3 edge cases per problem

āš ļø Common Mistakes

  • Jumping into code without discussing the approach — Google explicitly evaluates your problem decomposition skills

  • Writing Java-style code in Kotlin — using 'var' everywhere, manual null checks instead of safe calls, not using extension functions

  • Not testing your code — walk through at least 2 examples and 1 edge case after writing

  • Over-engineering — using complex patterns when a simple approach works. Start simple, optimize if needed

  • Staying silent while coding — Google wants to hear your reasoning, even when you're stuck

šŸ’¼ Interview Questions

šŸŽ¤ Mock Interview

Mock interview is powered by AI for Coding Round Expectations (Senior Level). Login to unlock this feature.