FOLIO / KATA
Practice turns problems into patterns.
Algorithms, mathematics, and other problems worked through one step at a time.
Latest problem.
Kata 064LeetCode
Squares of a Sorted Array
Given a sorted integer array return the squares of its elements in non-decreasing order
Easyalgorithmarraytwo-pointerssorting
Rhythm.
Last year64 problems
JanFebMarAprMayJunJulAugSepOctNovDec
none1 problem2 problems
2026
All problems
难度
64 / 64064Squares of a Sorted ArrayGiven a sorted integer array return the squares of its elements in non-decreasing orderEasy063Minimum Common ValueGiven two sorted integer arrays return their smallest common value or -1 if none existsEasy062Long Pressed NameGiven a name and a typed string determine whether typed could result from long-pressing characters in nameEasy061Is SubsequenceGiven two strings determine whether the first is a subsequence of the secondEasy060Valid Palindrome IIGiven a string determine whether it can become a palindrome after deleting at most one characterEasy059Reverse Vowels of a StringGiven a string reverse only the vowels while keeping all other characters in placeEasy058Merge Strings AlternatelyGiven two strings merge them by alternating characters and appending any remaining suffixEasy057Online Stock SpanGiven a stream of daily stock prices return the span of each price compared with consecutive previous pricesMedium056Daily TemperaturesGiven daily temperatures return how many days each day must wait until a warmer temperatureMedium055Final Prices With a Special Discount in a ShopGiven item prices apply the first later price that is less than or equal as a discountEasy054Next Greater Element IGiven two arrays nums1 and nums2 find the next greater element in nums2 for each value in nums1Easy053Build an Array With Stack OperationsGiven a target array and n return the stack operations needed to build target from numbers 1 to nMedium052Crawler Log FolderGiven folder change logs return the minimum operations needed to go back to the main folderEasy051Clear DigitsGiven a string remove each digit and the closest non-digit character to its leftEasy050Make The String GreatGiven a string remove adjacent same-letter characters with different cases until no such pair remainsEasy049Remove All Adjacent Duplicates In StringGiven a string remove adjacent duplicate pairs repeatedly until no such pair remainsEasy048Backspace String CompareGiven two strings containing backspace characters determine whether they are equal after processing backspacesEasy047Baseball GameGiven a list of baseball scoring operations calculate the final scoreEasy046Single NumberGiven a non-empty integer array where every element appears twice except one return the element that appears onceEasy045Majority ElementGiven an integer array return the element that appears more than half of the timeEasy044Factorial Trailing ZeroesGiven an integer n return the number of trailing zeroes in n factorialMedium043Intersection of Two Arrays IIGiven two integer arrays return their intersection including duplicate occurrencesEasy042Bulb SwitcherGiven n bulbs toggled over n rounds count how many remain onMedium041Happy NumberGiven an integer determine whether repeatedly replacing it with the sum of squares of its digits eventually reaches 1Easy040Nim GameGiven n stones determine whether the first player can win when each turn removes one to three stonesEasy039Intersection of Two ArraysGiven two integer arrays return an array of their unique intersectionEasy038Word PatternGiven a pattern and a string of words determine whether the words follow the same one-to-one patternEasy037Isomorphic StringsGiven two strings determine whether each character in one string can map consistently and uniquely to the otherEasy036Longest PalindromeGiven a string return the length of the longest palindrome that can be built with its lettersEasy035Find the DifferenceGiven two strings where one is a shuffled version of the other with one extra character return the extra characterEasy034First Unique Character in a StringGiven a string return the index of the first non-repeating character or -1 if none existsEasy033Ransom NoteGiven strings ransomNote and magazine determine whether ransomNote can be constructed from the letters in magazineEasy032Jewels and StonesGiven strings jewels and stones count how many stones are jewelsEasy031Cousins in Binary TreeGiven the root of a binary tree and two node values determine whether the two nodes are cousinsEasy030Fizz BuzzGiven an integer n return the Fizz Buzz representation for numbers from 1 to nEasy029Average of Levels in Binary TreeGiven the root of a binary tree return the average value of the nodes on each levelEasy028Sum of Left LeavesGiven the root of a binary tree return the sum of all left leaf valuesEasy027Binary Tree PathsGiven the root of a binary tree return all root-to-leaf paths as stringsEasy026Path SumGiven the root of a binary tree and a target sum determine whether any root-to-leaf path sums to the targetEasy025Minimum Depth of Binary TreeGiven the root of a binary tree return its minimum depthEasy024Diameter of Binary TreeGiven the root of a binary tree return the length of the longest path between any two nodesEasy023Balanced Binary TreeGiven the root of a binary tree determine whether it is height-balancedEasy022Subtree of Another TreeGiven the roots of two binary trees determine whether one tree contains the other as a subtreeEasy021Symmetric TreeGiven the root of a binary tree determine whether it is a mirror of itselfEasy020Same TreeGiven the roots of two binary trees determine whether they are structurally identical and have the same node valuesEasy019Maximum Depth of Binary TreeGiven the root of a binary tree return its maximum depthEasy018Invert Binary TreeGiven the root of a binary tree invert the tree and return its rootEasy017Plus OneGiven a non-empty array of digits representing a non-negative integer add one to the integerEasy016Middle of the Linked ListGiven the head of a singly linked list return the middle nodeEasy015Linked List CycleGiven the head of a linked list determine whether the list contains a cycleEasy014Reverse Linked ListGiven the head of a singly linked list reverse the list and return the new headEasy013Roman to IntegerGiven a roman numeral convert it to an integerEasy012First Bad VersionGiven n product versions and an API that identifies bad versions find the first bad versionEasy011Climbing StairsGiven a staircase with n steps count how many distinct ways you can climb it when each move is 1 or 2 stepsEasy010Move ZeroesGiven an integer array move all zeroes to the end while keeping the relative order of non-zero elementsEasy009Maximum SubarrayGiven an integer array find the contiguous subarray with the largest sum and return that sumEasy008Valid PalindromeGiven a string determine whether it reads the same forward and backward after removing non-alphanumeric characters and ignoring caseEasy007Contains DuplicateGiven an array of integers determine whether any value appears at least twiceEasy006Merge Two Sorted ListsGiven two sorted linked lists merge them into one sorted linked listEasy005Valid ParenthesesGiven a string of brackets determine whether every bracket is closed in the correct orderEasy004Valid AnagramGiven two strings determine whether they contain the same characters with the same countsEasy003Binary SearchGiven a sorted array and a target find the target index or return -1Easy002Best Time to Buy and Sell StockGiven daily stock prices find the maximum profit from one buy and one sellEasy001Two SumGiven an array of integers and a target find two numbers that add up to the targetEasy