Sort Colors
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…
Master C, C++, Data Structures, Algorithms, Design Patterns, and More!
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…
Given a character array s, reverse the order of its elements in-place.
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Modify the array in-place with…
Given an array nums and a value val, remove all instances of that value in-place and return the new length of the array. Do not allocate extra space for another…
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length. Do not allocate extra space for another array. Modify…
Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. A palindrome is a word, phrase, number, or other sequences of characters that…
Given an array numbers that is sorted in non-decreasing order and a target target, find two numbers in the array such that they add up to the target. You may…
Given an array nums of n integers, find all unique triplets in the array that sum up to zero. Each triplet must be in non-descending order (i.e., the elements of…
Given an array height of non-negative integers representing the heights of lines on a 2D plane, where the width of each line is 1, find two lines which, together with…
Given an array of integers arr that represents a mountain, you need to find the peak index. A peak index is an index such that arr arr.…