FastPrepBrowser History Operations
Problems/Browser History Operations

Browser History Operations

Roblox logoRoblox● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Roblox new grad onsite interview. The candidate asks for browser history with forward, back, and new-website methods. We chose this batch interface, the step counts, stopping at the ends, deleting forward history, how repeated pages work, and the size limits. Our version is about 85% the same as the reported question.

Implement the history of one browser tab, starting at homepage. Process the operations in actions in order. The entries at the same index in pages and steps give each operation’s arguments.

For this exercise, assume the operations have these rules:

  • visit: visit pages[i]. Discard all forward history, then add the new page after the current entry. Visiting the same identifier again creates a separate history entry.
  • back: move backward by up to steps[i] entries. Stop at the earliest entry if fewer are available.
  • forward: move forward by up to steps[i] entries. Stop at the latest entry if fewer are available.

Return the current page after every operation, including visits and operations that cannot move. Treat each page identifier as a string label. Do not interpret its contents, and treat uppercase and lowercase letters as different. An empty operation list returns an empty array.

Function

browserHistory(homepage: String, actions: String[], pages: String[], steps: int[]) → String[]

Examples

Example 1

homepage = "home"actions = ["visit","visit","back","visit","forward","back","forward"]pages = ["b","c","","d","","",""]steps = [0,0,1,0,1,10,2]return = ["b","c","b","d","d","home","d"]

After returning to b, visiting d removes c from forward history. Large back movement stops at home.

Example 2

homepage = "home"actions = []pages = []steps = []return = []

No operations produce no output entries.

Example 3

homepage = "h"actions = ["visit","visit","back","back","forward"]pages = ["a","a","","",""]steps = [0,0,1,1,2]return = ["a","a","a","h","a"]

The two visits to a create separate entries. Two one-step back operations are needed to reach h.

Constraints

  • 0 <= actions.length <= 200, and pages.length = steps.length = actions.length.
  • Each action is exactly visit, back, or forward.
  • homepage and each visited page contain 1 to 60 characters. Allowed characters are English letters, digits, period, slash, colon, underscore and hyphen.
  • For a visit, pages[i] is the visited identifier and steps[i] = 0.
  • For back or forward, pages[i] is empty and 0 <= steps[i] <= 10^9.

More Roblox Onsite Interview questions

  • Most Frequent Call Path From Function Trace LogsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Search Autocomplete SystemPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Candy Crush Grid Matching and GravityPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Topological Sort with Secondary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Most Frequent Call Stack Per ThreadPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Count and Score Distinct Hat AssignmentsONSITE INTERVIEW · Seen Sep 2026
  • Rate Limiter Sliding Window With Per-Entity LimitsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • Most Frequent Call Path in Interleaved LogsONSITE INTERVIEW · Seen Aug 2026
  • Grid Pathfinding with Obstacles (DFS)PHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2026
  • Maximize Distance to Closest Person — Return the SeatONSITE INTERVIEW · Seen Jun 2026

Similar questions at other companies

  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Fountain SafetyGoogle · ONSITE INTERVIEWGoogle interview questions
  • Trace Events from Stable Whole-Stack StatesAnthropic · ONSITE INTERVIEWAnthropic interview questions
  • Surviving Balls after Directional CollisionsSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Render a Comment HierarchyAmazon · ONSITE INTERVIEW
  • Asteroid CollisionAdobe · ONSITE INTERVIEWAdobe interview questions
  • Asteroid CollisionZscaler · ONSITE INTERVIEWZscaler interview questions
  • Asteroid CollisionBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Exclusive Time of FunctionsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Implement Stack Push and Pop OperationsLSEG · ONSITE INTERVIEWLSEG interview questions

Interview reports that mention this question

  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)

Roblox interview experiences

  • Roblox OA: What It Tests (2026)
  • Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)
  • Roblox New Grad CodeSignal Finals: 23 Experiences (Part 4 of 7)
  • Roblox New Grad Games and BQ: 25 Experiences (Part 3 of 7)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public String[] browserHistory(String homepage, String[] actions, String[] pages, int[] steps) {
        // write your code here
    }

}
Checking account…