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

Reverse String

EasyTwo Pointers

Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place.

AmazonQualcommSwiggy

Reverse Vowels of a String

EasyTwo Pointers

Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u'.

AmazonQualcommVMware (Broadcom)

Merge Sorted Array

EasyTwo Pointers

You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order.

BrowserStackOktaSnowflake

Valid Palindrome II

EasyTwo Pointers

Given a string s, return true if the s can be palindrome after deleting at most one character from it.

AtlassianDatadogFlipkart

Intersection of Two Arrays

EasyTwo Pointers

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order.

ElasticIntuit IndiaOkta

Backspace String Compare

EasyTwo Pointers

Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character.

BrowserStackConfluentJP Morgan Chase

Squares of a Sorted Array

EasyTwo Pointers

Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.

ElasticFlipkartStripe

4Sum

MediumTwo Pointers

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that the sum equals target.

HasuraIntuit IndiaSalesforce India

Remove Element

EasyTwo Pointers

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val.

Cisco IndiaGitLabQualcomm

Assign Cookies

EasyTwo Pointers

Assume you are an awesome parent and want to give your children some cookies. Each child has a greed factor g[i] and each cookie has a size s[j]. Find the maximum number of content children.

PlaidQualcommWalmart Global Tech

Sort Colors

MediumTwo Pointers

Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue. We use integers 0, 1, and 2.

AdobeJP Morgan ChaseMicrosoft