Practice DSA interview questions

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

Chrome Tab History Unique Domains

MediumSliding Window

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.

Cisco IndiaGoldman SachsMongoDB

Malware Signature Detection

MediumSliding Window

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.

DatabricksDatadogOracle

Trading Dashboard Rolling High

HardSliding Window

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.

ConfluentOracleSwiggy

Smart Home Motion Sensor Uptime

MediumSliding 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.

Cisco IndiaOktaSnowflake

Cloud Billing Budget Threshold

MediumSliding Window

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.

BrowserStackHasuraOracle

Plagiarism Checker Snippet Match

MediumSliding Window

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.

CREDPlaidSAP Labs

Social Media Viral Hashtag Grouping

MediumSliding Window

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.

GooglePostmanSwiggy

E-commerce Cart Combination Limits

MediumSliding Window

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.

DatabricksSalesforce IndiaSamsung R&D

DNA Sequence Mutation Analyzer

MediumSliding Window

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.

AirbnbBrowserStackRippling

IoT Sensor Anomaly Detection

MediumSliding Window

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.

HasuraMongoDBWalmart Global Tech

Fraud Detection Repeat IP Logins

EasySliding Window

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.

AtlassianFlipkartSalesforce India

Fitness App Weekly Calorie Tracker

EasySliding Window

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.

ElasticGoogleRubrik

Picking Optimal Server Nodes

MediumSliding Window

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.

ConfluentDatadogJP Morgan Chase

Network Uptime Longest Streak

MediumSliding Window

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.

PostmanStripeSwiggy

Password Strength Validator

MediumSliding Window

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.

AtlassianOracleQualcomm

NLP Text Analyzer Vowels

MediumSliding Window

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.

PlaidPostmanQualcomm

Defragmentation Algorithm Storage

MediumSliding Window

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.

GitLabHasuraSnowflake

SaaS Support Satisfaction Optimizer

MediumSliding Window

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.

AmazonPlaidRippling

Traffic Congestion Relief Window

MediumSliding Window

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.

MicrosoftOracleStripe

Log File Error Burst Detection

MediumSliding Window

Given an array of log severities, find the shortest window that contains at least K critical errors (represented by severity level 5).

QualcommSamsung R&DWalmart Global Tech

Chat Filter Symmetry Check

EasyTwo Pointers

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.

Cisco IndiaConfluentGitLab

Risk Management Portfolio Balancing

MediumTwo Pointers

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.

AirbnbAtlassianStripe

Cloud Storage Cost Optimization

MediumTwo Pointers

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.

AtlassianSwiggyVMware (Broadcom)

Data Lake Capacity Calculator

HardTwo Pointers

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.

BrowserStackGoldman SachsTwilio

Database Index Deduplication

EasyTwo Pointers

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.

BrowserStackCREDQualcomm

Garbage Collection Memory Compaction

EasyTwo Pointers

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.

DatadogHasuraOracle

Git Commit History Tracking

EasyTwo Pointers

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.

ConfluentDatadogGoogle

Reverse Log Viewer

EasyTwo Pointers

A dashboard requires displaying a log file array in reverse chronological order. Reverse the given array of strings in-place.

AdobeMicrosoftSnowflake

Captcha Obfuscation

EasyTwo Pointers

A basic captcha generator takes a word and reverses only the vowels in the string, leaving consonants in place. Implement this obfuscation.

AtlassianJP Morgan ChaseSnowflake

Merging Sorted Microservice Logs

EasyTwo Pointers

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.

BrowserStackCisco IndiaJP Morgan Chase