UBS OA India 2025

Result
Ongoing
Location
India
Posted
30 Aug 2025
356 reads

Summary

I recently participated in the UBS Online Assessment for 2025 in India. The assessment featured a challenging algorithmic problem focused on IP request validation, incorporating both blacklist matching and rate limiting rules.

How it went

I recently sat for the UBS Online Assessment in India, aiming for a position in the 2025 batch. The assessment primarily tested my problem-solving abilities, and one of the core questions presented involved implementing a sophisticated firewall system. This system needed to validate incoming IP requests against a dynamic blacklist, which included wildcard patterns, and also enforce rate limiting to prevent an excessive number of requests from a single IP within a short timeframe. It was a comprehensive problem that required careful consideration of both string matching and time-window based data management.

Questions asked (1)

  1. 01

    Validate IP Requests with Blacklist and Rate Limiting

    Data Structures & Algorithms

    You are developing a firewall software and need to block certain requests based on blacklisted IP addresses and request history. There are two conditions for blocking a request:
    Rule 1: Blacklist Match

    • If the IP address matches any of the blacklisted IP patterns, the request should be blocked.
    • A blacklisted IP pattern may contain a * wildcard, which matches zero or more characters.

    Rule 2: Too Many Requests
    • If an IP address has made two or more unblocked requests in the last 5 seconds, the request should be blocked.

    You are given:
    • A list of blacklisted_ips, where each element is a string (possibly with *)
    • A list of requests, where each element is an IP string (the index represents the timestamp in seconds, i.e. requests[i] occurs at time i)

    Task: Implement the following function: validate_requests(blacklisted_ips, requests)
    Return a list of integers where:
    • 1 means the request is blocked
    • 0 means the request is allowed

    Example: blacklisted_ips = ["45.*", "123.45.67.89", "*.100"] requests = [ "45.1.2.3", "123.45.67.89", "99.99.99.100", "10.10.10.10", "10.10.10.10", "10.10.10.10", "10.10.10.10", "99.99.99.100" ] Output: [1, 1, 1, 0, 0, 1, 0, 1]

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at UBS recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!