Match Chromebooks to Students by Minimum Spec Requirement

Last updated: November 29, 2026

Quick Overview

Each student needs a Chromebook with at least a given RAM size, and each device can go to one student. Given student needs and device specs, return the maximum number of students who get a suitable device.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Each student needs a Chromebook with at least a given RAM size, and each device can go to one student. Given student needs and device specs, return the maximum number of students who get a suitable device.

A warm-up in the style Google uses early in a phone screen, framed around Chromebooks for Education. The interviewer checks that you sort both sides, use two pointers, and can explain why giving each student the smallest sufficient device never hurts.

What the Interviewer Expects
  • Sort both lists
  • Two-pointer sweep giving the smallest adequate device to the least demanding student
  • Explain why the greedy pairing is optimal
  • O(n log n + m log m) time
  • Clean loop termination
Key Topics to Cover
Greedy
Two pointers
Sorting
Matching
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Return the actual assignment of device to student.
  • Devices have a cost; satisfy the most students and break ties by lowest cost.
  • Each device can serve up to two students with combined need under its RAM.
  • Specs are multidimensional (RAM and storage). Does the greedy still hold?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: needs (list of ints) and specs (list of ints). A student with need g is satisfied by a device with spec s >= g. Each device is used once. Output: the maximum number of satisfied student...

High-Level Design

Sort both lists ascending. Walk devices from smallest to largest with a pointer into students. If the current device meets the current least-demanding unsatisfied student, assign it and move to the ne...


Submit Your Answer
Markdown supported