FastPrepMinimum Processes for Page Origins
Problems/Minimum Processes for Page Origins

Minimum Processes for Page Origins

Oracle logoOracle● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Oracle phone screen. The interviewer asked for the smallest number of processes needed, given page URLs with a scheme, a host, and a port.

The report does not say when pages may share a process, what a URL looks like, or what to do with a missing port. Here, pages share a process only when their scheme, host, and port all match, and any number of such pages fit in one process, so you count distinct origins. Each URL is http or https, then ://host, an optional :port, and an optional path, and a missing port means 80 for http and 443 for https.

Our version is about 50% the same as the reported question.

A browser opens one page for every URL in urls. Two pages may share a process only when they have the same origin: the same scheme, the same host, and the same port. Any number of pages with the same origin can share one process.

Every URL has the form scheme://host, optionally followed by :port, optionally followed by a path that starts with /. When the port is missing, it is 80 for http and 443 for https. The path never affects the origin.

Return the minimum number of processes needed to open every page.

Function

minimumProcesses(urls: String[]) → int

Examples

Example 1

urls = ["https://shop.example.com/cart","https://shop.example.com/","https://shop.example.com:443/help","http://shop.example.com/cart"]return = 2

The first three pages all use https, host shop.example.com, and port 443 (written out in the third URL, filled in by default for the others), so they share one process. The last page uses http on port 80, which is a different origin. The answer is 2.

Example 2

urls = ["http://a.com:8080/x","http://a.com:8081/x","http://b.com:8080/x"]return = 3

All three pages differ in port or host, so each needs its own process. The answer is 3.

Example 3

urls = ["http://news.site.org","http://news.site.org:80/today"]return = 1

The first URL has no port, so it uses 80, the same port as the second. Both pages share one process, so the answer is 1.

Constraints

  • 1 <= urls.length <= 10^4
  • 1 <= urls[i].length <= 100
  • The scheme is http or https.
  • The host is 1 to 30 characters from lowercase letters, digits, ., and -.
  • A port, when present, is a number from 1 to 65535 with no leading zeros.
  • A path, when present, starts with / and uses only lowercase letters, digits, /, ., _, and -.

More Oracle Phone Screen questions

  • Remove Parentheses from a Plus-Minus ExpressionPHONE SCREEN · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · Seen Oct 2026
  • Shortest Window by Distinct-Value SumPHONE SCREEN · Seen Oct 2026
  • Detect a Cycle in a Directed GraphPHONE SCREEN · Seen Oct 2026
  • Time-Based Key-Value StorePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Remove Adjacent Duplicates in String IIPHONE SCREEN · Seen Oct 2026
  • Sum Root-to-Leaf Binary NumbersPHONE SCREEN · Seen Oct 2026
  • Longest All-Present Attendance StreakPHONE SCREEN · Seen Oct 2026
  • Next PermutationPHONE SCREEN · Seen Sep 2026
  • Valid ParenthesesPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Transaction Fee Calculator — Parts 1–2: Basic Fee Calculation and Conditional Fee RulesStripe · PHONE SCREENStripe interview questions
  • Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
  • First Letter to Appear TwiceCisco · PHONE SCREENCisco interview questions
  • Halfway Course in a Single TrackCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Single-Condition Product FilterCrowdstrike · PHONE SCREENCrowdstrike interview questions
  • Summarize Server Healthcheck LogsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Known Words Matching Phone DigitsLinkedIn · PHONE SCREENLinkedIn interview questions
  • First Non-Repeated CharacterDell Technologies · PHONE SCREENDell Technologies interview questions
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • First Non-Repeating CharacterGoldman Sachs · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions

Oracle interview experiences

  • Oracle SWE Onsite Interview Experience: 1 Experience
All Oracle interview questionsSee Oracle hiring insights
Saved
class Solution {
    public int minimumProcesses(String[] urls) {
        // Write your code here.
    }
}
Checking account…