Chrome Tab History Unique Domains
You are building a browser analytics tool. Given a user's browsing history as a string of domain IDs, find the length of the longest continuous browsing session without visiting the same domain twice.
2000+ data structures and algorithms problems, tagged by company and difficulty. Browse the full bank free, then log in to solve, track progress and see detailed solutions.
Difficulty
Category
701 questions
You are building a browser analytics tool. Given a user's browsing history as a string of domain IDs, find the length of the longest continuous browsing session without visiting the same domain twice.
You are building an antivirus engine. Given a file stream (string) and a malware signature, return true if any permutation of the signature exists as a contiguous block in the file.
You are building a real-time crypto trading dashboard. Given an array of ticker prices and a time window K, return an array of the maximum price within each sliding window.
You are analyzing smart home security logs. An array of 1s (motion) and 0s (no motion) is given. You can ignore up to K sensor failures (flip 0 to 1). Find the longest continuous motion period.
You are tracking daily AWS cloud costs in an array. Find the minimal number of consecutive days where the total cost meets or exceeds a user's defined budget alert threshold.
You are building a code plagiarism checker. Given a source document and a snippet, find all starting indices in the document where an exact anagram of the snippet occurs.
You are analyzing X (Twitter) trends. You can artificially boost a hashtag's frequency K times. Find the maximum possible frequency of any single hashtag in a sorted continuous timeline.
An e-commerce API requires verifying promotional bundles. Given an array of item prices, find the number of contiguous sub-bundles where the product of all prices is strictly less than K.
You are building software for CRISPR analysis. Given a DNA sequence (A,C,G,T), you can mutate at most K base pairs. Find the longest contiguous sequence of identical base pairs possible.
You are monitoring temperature arrays from factory machines. Trigger an alert if any continuous block of K minutes has an average temperature greater than or equal to a critical threshold.
A banking app logs user IPs. Detect a brute-force attack if the exact same IP address attempts a login twice within a tight window of K seconds.
You are building a fitness SaaS. Given an array of daily calories and a K-day cycle, award 1 point if cycle sum > upper, deduct 1 if < lower. Return total points.
AWS edge network gives you an array of node capacities. You can pick K contiguous nodes from either the extreme left edge or extreme right edge. Maximize total capacity.
A server's daily status is an array of 1s (up) and 0s (down). You are allowed to ignore exactly one day of downtime. Find the longest continuous streak of uptime.
A security module requires a password to have substrings of length K with absolutely no repeated characters. Count how many such unique substrings exist in a given password.
An NLP pipeline assigns sentiment weight based on vowel density. Given a text string, find the maximum number of vowels in any substring of exactly length K.
A hard drive block has fragmented 1s (used) and 0s (free space). Find the minimum number of swaps to group all 1s together into a continuous block.
A support queue has arrays of customers and a boolean array indicating if an agent was 'grumpy'. You can make an agent 'not grumpy' for K continuous minutes. Maximize satisfied customers.
A smart city traffic array shows cars per minute. A traffic cop can divert traffic for K continuous minutes, reducing car count to 0. Minimize the maximum cars in any window.
Given an array of log severities, find the shortest window that contains at least K critical errors (represented by severity level 5).
A discord chat filter flags potentially obfuscated slurs that are palindromes. Given a message, ignore non-alphanumeric characters and case, and check if it reads the same backward and forward.
A fintech app balances portfolios to a net-zero risk. Given an array of asset risk scores, find all unique triplets of assets that sum to exactly 0.
AWS S3 bucket bounds are represented by an array of heights. Select two bounds that maximize the rectangular area formed between them to optimize block storage allocation.
A data lake topology is represented by an elevation map. Calculate exactly how many units of data (water) can be trapped between the server rack barriers.
A clustered index is sorted but contains duplicate primary keys due to a bug. Remove duplicates in-place so each unique key appears only once, returning the new length.
A JVM heap array contains 0s representing freed memory blocks. Move all 0s to the end of the array while maintaining the relative order of active memory objects.
A developer searches if commit sequence S is a subsequence of the master branch T. S does not need to be contiguous, but relative order must be maintained.
A dashboard requires displaying a log file array in reverse chronological order. Reverse the given array of strings in-place.
A basic captcha generator takes a word and reverses only the vowels in the string, leaving consonants in place. Implement this obfuscation.
Two distributed microservices return chronologically sorted arrays of log timestamps. Merge them in-place into the first array, which has trailing zeros allocated for space.