Language
Kotlin archive
Every library entry that currently exposes Kotlin code or a Kotlin solution link.
1261 entries
Daily solutions with Kotlin available either directly in the archive or via linked solution pages.
24.04.2026
easy2833. Furthest Point From Origin
Max dist when replace with L or R
23.04.2026
medium2615. Sum of Distances
Sum of distances to each occurance
22.04.2026
medium2452. Words Within Two Edits of Dictionary
Words in dictionary with 2 edits
21.04.2026
medium1722. Minimize Hamming Distance After Swap Operations
Diff src vs target after rearrange by rules
20.04.2026
easy2078. Two Furthest Houses With Different Colors
Max distance between different numbers
19.04.2026
medium1855. Maximum Distance Between a Pair of Values
Max distance a[i] not greater than b[j] window
18.04.2026
easy3783. Mirror Distance of an Integer
Diff with reversal
17.04.2026
medium3761. Minimum Absolute Distance Between Mirror Pairs
Distance to prev mirror number
16.04.2026
medium3488. Closest Equal Element Queries
Shortest distances to the same values
15.04.2026
easy2515. Shortest Distance to Target String in a Circular Array
Distance to target
14.04.2026
hard2463. Minimum Total Distance Traveled
Shortest distances to travel robots to factories
13.04.2026
easy1848. Minimum Distance to the Target Element
Distance to target from start
12.04.2026
hard1320. Minimum Distance to Type a Word Using Two Fingers
Min travel on keyboard to type a word
11.04.2026
medium3741. Minimum Distance Between Three Equal Elements II
Min sum of distances between i,j,k of the same values
10.04.2026
easy3740. Minimum Distance Between Three Equal Elements I
Min sum of distances between i,j,k of the same values
09.04.2026
hard3655. XOR After Range Multiplication Queries II
Run stepped multiplication queries
08.04.2026
medium3653. XOR After Range Multiplication Queries I
Run queries
07.04.2026
medium2069. Walking Robot Simulation II
Implement perimeter-robot
06.04.2026
medium874. Walking Robot Simulation
Farthest robot movement
05.04.2026
easy657. Robot Return to Origin
R,L,U,D return to 0 in XY plane
04.04.2026
medium2075. Decode the Slanted Ciphertext
Decode row-encoded string
03.04.2026
hard3661. Maximum Walls Destroyed by Robots
Max walls hit, each robot shoot left or right
02.04.2026
medium3418. Maximum Amount of Money Robot Can Earn
Max sum path, 2 skips allowed
01.04.2026
hard2751. Robot Collisions
Collide LR robots
31.03.2026
hard3474. Lexicographically Smallest Generated String
String from pattern matches
30.03.2026
medium2840. Check if Strings Can be Made Equal With Operations II
Strings equal at odd-even positions
29.03.2026
easy2839. Check if Strings Can be Made Equal With Operations I
Match a and b at (0|2,1|3) positions
28.03.2026
hard2573. Find the String with LCP
Build string from longest common prefixes matrix
27.03.2026
easy2946. Matrix Similarity After Cyclic Shifts
Shift rows k times left and right
26.03.2026
hard3548. Equal Sum Grid Partition II
Cut matrix in half sums, can remove one cell
25.03.2026
medium3546. Equal Sum Grid Partition I
Split matrix to equal sums
24.03.2026
medium2906. Construct Product Matrix
Product of other cells in a matrix
23.03.2026
medium1594. Maximum Non Negative Product in a Matrix
Max product path right-down
22.03.2026
easy1886. Determine Whether Matrix Can Be Obtained By Rotation
Rotate matrix
21.03.2026
medium3643. Flip Square Submatrix Vertically
Reverse submatrix k by k
20.03.2026
medium3567. Minimum Absolute Difference in Sliding Submatrix
Mid diffs in k k submatrices
19.03.2026
medium3212. Count Submatrices With Equal Frequency of X and Y
Count prefix freq X == freq Y
18.03.2026
medium3070. Count Submatrices with Top-Left Element and Sum Less Than k
Count prefix sums less than K
17.03.2026
medium1727. Largest Submatrix With Rearrangements
Max area of binary matrix, swap columns
16.03.2026
medium1878. Get Biggest Three Rhombus Sums in a Grid
Top 3 rhombus sums
15.03.2026
hard1622. Fancy Sequence
Design: add number, mulriply all, add all
14.03.2026
medium1415. The k-th Lexicographical String of All Happy Strings of Length n
K-th generated abc non-repeating string
13.03.2026
medium3296. Minimum Number of Seconds to Make Mountain Height Zero
Min steps to work a mountain with arithmetic-sum-workers
12.03.2026
hard3600. Maximize Spanning Tree Stability with Upgrades
Max of min values in span tree of graph, 2 s at most k
11.03.2026
easy1009. Complement of Base 10 Integer
Invert binary
10.03.2026
hard3130. Find All Possible Stable Binary Arrays II
array to make with z zeros, o ones, l repeats
09.03.2026
medium3129. Find All Possible Stable Binary Arrays I
Count 01-arrays with z zeros, o ones, at most l repeat
08.03.2026
medium1980. Find Unique Binary String
Uniq bits not in a set
07.03.2026
medium1888. Minimum Number of Flips to Make the Binary String Alternating
Min flips to make 01 alterating string sum window
06.03.2026
easy1784. Check if Binary String Has at Most One Segment of Ones
+0 pattern
05.03.2026
easy1758. Minimum Changes To Make Alternating Binary String
Min flips to make bits alterating
04.08.2026
easy1582. Special Positions in a Binary Matrix
Count single 1-row-column
03.03.2026
medium1545. Find Kth Bit in Nth Binary String
Kth bit in s=s+1+inv(rev(s)) sequence
02.03.2026
medium1536. Minimum Swaps to Arrange a Binary Grid
Min rows swaps to zero above diagonal
01.03.2026
medium1689. Partitioning Into Minimum Number Of Deci-Binary Numbers
Min 01-strings add up to target
28.02.2026
medium1680. Concatenation of Consecutive Binary Numbers
Concat binaries 1..n
27.02.2026
hard3666. Minimum Operations to Equalize Binary String
Min steps to convert 01 stirng to ones flipping K
26.02.2026
medium1404. Number of Steps to Reduce a Number in Binary Representation to One
Ops /2+1 to make 1
25.02.2026
easy1356. Sort Integers by The Number of 1 Bits
Sort
24.02.2026
easy1022. Sum of Root To Leaf Binary Numbers
Sum of a binary numbers in a binary tree
23.02.2026
medium1461. Check If a String Contains All Binary Codes of Size K
All numbers as substring length of k window
22.02.2026
easy868. Binary Gap
Distance between onces in a binary
21.02.2026
easy762. Prime Number of Set Bits in Binary Representation
Number in l..r with prime bits count
20.02.2026
hard761. Special Binary String
Swaps of 1M0-special substring to make string large
19.02.2026
easy696. Count Binary Substrings
Count substrings of 01 and 10 window
18.02.2026
easy693. Binary Number with Alternating Bits
Alternating bits
17.02.2026
easy401. Binary Watch
All times with count bits set
16.02.2026
easy190. Reverse Bits
Reverse bits
15.02.2026
easy67. Add Binary
Binary strings sum
14.02.2026
medium799. Champagne Tower
Flow in a Pascal's Triangle
13.02.2026
medium3714. Longest Balanced Substring II
Largest equal frequencies substring of abc-string
12.02.2026
medium3713. Longest Balanced Substring I
Max substring with equal frequencies window
11.02.2026
hard3721. Longest Balanced Subarray II
Max subarray evens count = odds count tree
10.02.2026
medium3719. Longest Balanced Subarray I
Longes even=odd subarray
09.02.2026
medium1382. Balance a Binary Search Tree
Balance binary search tree
08.02.2026
easy110. Balanced Binary Tree
Is tree balanced?
07.02.2026
medium1653. Minimum Deletions to Make String Balanced
Min removal to balance 'ab'
06.02.2026
medium3634. Minimum Removals to Balance Array
Min removals to make min k not less than max window
05.02.2026
easy3379. Transformed Array
Shuffled list i+n[i]
03.02.2026
easy3637. Trionic Array I
Validate inc,dec,inc sequency
02.02.2026
hard3013. Divide an Array Into Subarrays With Minimum Cost II
Min sum of k splits at max d distance window
01.02.2026
easy3010. Divide an Array Into Subarrays With Minimum Cost I
Split on 2 min values
31.01.2026
easy744. Find Smallest Letter Greater Than Target
Larger letter in array
30.01.2026
hard2977. Minimum Cost to Convert String II
Min cost to convert string with transitions of substrings
29.01.2026
medium2976. Minimum Cost to Convert String I
Min cost to convert string
28.01.2026
hard3651. Minimum Cost Path with Teleportations
Min cost to walk 2D grid with free teleports
27.01.2026
medium3650. Minimum Cost Path with Edge Reversals
Min path in weighted graph with reverse 2w nodes
26.01.2026
easy1200. Minimum Absolute Difference
Min diff pairs
25.01.2026
easy1984. Minimum Difference Between Highest and Lowest of K Scores
Min k-diff window
24.01.2026
medium1877. Minimize Maximum Pair Sum in Array
Min max pair
23.01.2026
hard3510. Minimum Pair Removal to Sort Array II
Sort by removing min-sum pairs
22.01.2026
easy3507. Minimum Pair Removal to Sort Array I
Sort by removing lowest sum pairs
21.01.2026
medium3315. Construct the Minimum Bitwise Array II
Reverse operation x or (x+1)
20.01.2026
easy3314. Construct the Minimum Bitwise Array I
Reverse x | (x+1) operation on prime numbers
19.01.2025
medium1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold
Max square with sum less than threshold
18.01.2026
medium1895. Largest Magic Square
Max magic square
17.01.2026
medium3047. Find the Largest Area of Square Inside Two Rectangles
Max square in intersection
16.01.2026
medium2975. Maximum Square Area by Removing Fences From a Field
Max square after remove vertical or horizontal bars
15.01.2026
medium2943. Maximize Area of Square Hole in Grid
Max square area after removing bars in a grid
14.01.2026
hard3454. Separate Squares II
Min y to equal split areas exclude intersections sweep
13.01.2026
medium3453. Separate Squares I
Min Y to split into equal areas
12.01.2026
easy1266. Minimum Time Visiting All Points
Euclid travel distance
11.01.2026
hard85. Maximal Rectangle
Max all-1 rectangle in 2D matrix stack
10.01.2026
medium712. Minimum ASCII Delete Sum for Two Strings
Min removed sum to make strings equal
09.01.2026
medium865. Smallest Subtree with all the Deepest Nodes
Lowest common ancestor of the deepest nodes
08.01.2026
hard1458. Max Dot Product of Two Subsequences
Max product of 2 subsequencies
07.01.2026
medium1339. Maximum Product of Splitted Binary Tree
Max sumA sumB of a tree split
06.01.2026
medium1161. Maximum Level Sum of a Binary Tree
Min level max sum in tree
05.01.2026
medium1975. Maximum Matrix Sum
Max sum after multiply -1 adjacent cells
04.12.2025
medium1390. Four Divisors
Sum of exactly four-divisors of each number
03.12.2026
hard1411. Number of Ways to Paint N × 3 Grid
Ways to color 3xN grid
02.01.2026
easy961. N-Repeated Element in Size 2N Array
Duplicate majority element
01.01.2026
easy66. Plus One
Increment big number
31.12.2025
hard1970. Last Day Where You Can Still Cross
Last day top connected to bottom in 2D matrix
30.12.2025
medium840. Magic Squares In Grid
Count 'magic' 3x3 squares
29.12.2025
medium756. Pyramid Transition Matrix
Can build a pyramid from transitions?
28.12.2025
easy1351. Count Negative Numbers in a Sorted Matrix
Count negatives in 2D sorted matrix
27.12.2025
hard2402. Meeting Rooms III
Most frequent room 0..n for meetings [s,e]
26.12.2025
medium2483. Minimum Penalty for a Shop
Min close time by customers max volune
25.12.2025
medium3075. Maximize Happiness of Selected Children
K max values, decreas each pick
24.12.2025
easy3074. Apple Redistribution into Boxes
Min containers for all apples sort
23.12.2025
medium2054. Two Best Non-Overlapping Events
Max at most two non-overlapping events max
22.12.2025
hard960. Delete Columns to Make Sorted III
Remove columns to sort strings
21.12.2025
medium955. Delete Columns to Make Sorted II
Remove columns to sort strings
20.12.2025
easy944. Delete Columns to Make Sorted
Count unsorted columns
19.12.2025
hard2092. Find All People With Secret
Time based secret spread in a graph
18.12.2025
medium3652. Best Time to Buy and Sell Stock using Strategy
Max Profit by modifying a sliding window sum
17.12.2025
medium3573. Best Time to Buy and Sell Stock V
K best deals buy/short/sell stocks
16.12.2025
hard3562. Maximum Profit from Trading Stocks with Discounts
Max profit in a tree
15.12.2025
medium2110. Number of Smooth Descent Periods of a Stock
Decreasing subarrays
14.12.2025
hard2147. Number of Ways to Divide a Long Corridor
Ways to split pairs of S
13.12.2025
easy3606. Coupon Code Validator
Filter a,b,c accroding to rules
12.12.2025
medium3433. Count Mentions Per User
Count messages and track online users
11.12.2025
medium3531. Count Covered Buildings
Count surrounded dots on XY plane
10.12.2025
medium3577. Count the Number of Computer Unlocking Permutations
Permutations to unlock all c[j] right and bigger than c[i]
09.12.2025
medium3583. Count Special Triplets
Count a[i]==a[j] 2==a[k] sum
08.12.2025
easy1925. Count Square Sum Triples
Count a^2+b^2=c^2 in 1..n range
07.12.2025
easy1523. Count Odd Numbers in an Interval Range
Odds l..h
06.12.2025
medium3578. Count Partitions With Max-Min Difference at Most K
Ways to partition into parts (max-min) at most k queue
05.12.2025
easy3432. Count Partitions with Even Sum Difference
Count Left sum - Right sum % 2
04.12.2025
medium2211. Count Collisions on a Road
Collisions R vs L
03.12.2025
hard3625. Count Number of Trapezoids II
Count trapezoids from points
02.12.2025
medium3623. Count Number of Trapezoids I
Trapezoids count
01.12.2025
hard2141. Maximum Running Time of N Computers
Max time to run n computers with batteries
30.11.2025
medium1590. Make Sum Divisible by P
Min removal to make sum%p
29.11.2025
easy3512. Minimum Operations to Make Array Sum Divisible by K
Sum % k
28.11.2025
hard2872. Maximum Number of K-Divisible Components
Max cuts where every subtree sum %k
27.11.2025
medium3381. Maximum Subarray Sum With Length Divisible by K
Max sum of %k-length subarray
26.11.2025
hard2435. Paths in Matrix Whose Sum Is Divisible by K
Paths in 2D matrix %k
25.11.2025
medium1015. Smallest Integer Divisible by K
Smallest number 11..1 % k
24.11.2025
easy1018. Binary Prefix Divisible By 5
Prefixes divisible by 5
23.10.2025
medium1262. Greatest Sum Divisible by Three
Max sum that %3
22.11.2025
easy3190. Find Minimum Operations to Make All Elements Divisible by Three
Min steps inc/dec to make %3
21.11.2025
medium1930. Unique Length-3 Palindromic Subsequences
palindroms subsequences
20.11.2025
hard757. Set Intersection Size At Least Two
Min set each interval have two values in it
19.11.2025
easy2154. Keep Multiplying Found Values by Two
First original=original 2 not in array
18.11.2025
easy717. 1-bit and 2-bit Characters
Is '0' last from characters '0','10','11' concatenation
17.11.2025
easy1437. Check If All 1's Are at Least Length K Places Away
All ones k-distant
16.11.2025
medium1513. Number of Substrings With Only 1s
Substrings of ones
15.11.2025
medium3234. Count the Number of Substrings With Dominant Ones
Subarray zeros^2 less than ones window
14.11.2025
medium2536. Increment Submatrices by One
Increase matrix by query of rectangles of ones
13.11.2025
medium3228. Maximum Number of Operations to Move Ones to the End
Max steps to move all ones to the right
12.11.2025
medium2654. Minimum Number of Operations to Make All Array Elements Equal to 1
Min steps to make all '1' by gcd
11.11.2025
medium474. Ones and Zeroes
Longest subsequence (ones,zeros) at most (m,n)
10.11.2025
medium3542. Minimum Operations to Convert All Elements to Zero
Min ops to zeros by making min of subarrays 0 stack
09.11.2025
easy2169. Count Operations to Obtain Zero
Count numbers subtractions until 0
08.11.2025
hard1611. Minimum One Bit Operations to Make Integers Zero
Min steps to make zero by xor 1 or xor rightmost+1
07.11.2025
hard2528. Maximize the Minimum Powered City
Max min r-range sum after adding total of k window
06.11.2025
medium3607. Power Grid Maintenance
Smallest in subgraph after turning some nodes off
05.11.2025
hard3321. Find X-Sum of All K-Long Subarrays II
Sums of x most frequent from k-windows
04.11.2025
easy3318. Find X-Sum of All K-Long Subarrays I
Sums of x most frequent from k-windows
03.11.2025
medium1578. Minimum Time to Make Rope Colorful
Min weighted removals to dedup
02.11.2025
medium2257. Count Unguarded Cells in the Grid
Count unseen cells by rays from guards
01.11.2025
medium3217. Delete Nodes From Linked List Present in Array
Remove an array from linked list
31.10.2025
easy3289. The Two Sneaky Numbers of Digitville
Two extra numbers from 0..n
30.10.2025
hard1526. Minimum Number of Increments on Subarrays to Form a Target Array
Min +1 range increases to make target from zeros
29.10.2025
easyWith All Set Bits
Next all bits set number
28.10.2025
easy3354. Make Array Elements Equal to Zero
Places & directions that lead the simulation to all zeros
27.10.2025
medium2125. Number of Laser Beams in a Bank
Count multiplications between rows
26.10.2025
medium2043. Simple Bank System
Design a bank
25.10.2025
easy1716. Calculate Money in Leetcode Bank
Add increasing sum of money, drop weekly gain on mondays
24.10.2025
medium2048. Next Greater Numerically Balanced Number
First bigger number freq[digit]=digit
23.10.2025
easy3461. Check If Digits Are Equal in String After Operations I
Fold each pair to (a+b)%10 until 2 left
22.10.2025
hard3347. Maximum Frequency of an Element After Performing Operations II
Max frequency after changing +k..-k ops elements window
21.10.2025
medium3346. Maximum Frequency of an Element After Performing Operations I
Max frequency after changing +k..-k ops elements window
20.10.2025
easy2011. Final Value of Variable After Performing Operations
do ++ or -- operation from 0
19.10.2025
medium1625. Lexicographically Smallest String After Applying Operations
Min string after shifting by b and rotating odd indice by a
18.10.2025
medium3397. Maximum Number of Distinct Elements After Operations
Distincts count after adding -k..k to each
17.10.2025
medium3003. Maximize the Number of Partitions After Operations
Max k-uniq parts after changing one letter
16.10.2025
medium2598. Smallest Missing Non-negative Integer After Operations
First positive number can't be build by adding/subtracting value
15.10.2025
medium3350. Adjacent Increasing Subarrays Detection II
Max k of adjucent increasing k-windows
14.10.2025
medium3349. Adjacent Increasing Subarrays Detection I
Any increasing consequent windows size k
13.10.2025
medium2273. Find Resultant Array After Removing Anagrams
Dedup anagrams
12.10.2025
medium3539. Find Sum of Array Product of Magical Sequences
Product of all good subsequences and permutations
11.10.2025
medium3186. Maximum Total Damage With Spell Casting
Max sum of choosen values, skip v[i]+1+2-1-2
10.10.2025
medium3147. Taking Maximum Energy From the Mystic Dungeon
Max k-distant suffix sum
09.10.2025
medium3494. Find the Minimum Amount of Time to Brew Potions
Min total time to finish all skills[i] mana[j], non-intersecting
08.10.2025
medium2300. Successful Pairs of Spells and Potions
Number of potions spells[i] bigger than success
07.10.2025
medium1488. Avoid Flood in The City
Replace zeros with numbers to avoid duplicates search
06.10.2025
hard778. Swim in Rising Water
Min time to swim to end, flooding every second
05.10.2025
medium417. Pacific Atlantic Water Flow
Cells travel to TL&BR in decrease order
04.10.2025
medium11. Container With Most Water
Max water container from two heights
03.10.2025
hard407. Trapping Rain Water II
Fill water in 3D
02.10.2025
medium3100. Water Bottles II
Total drinks with growing exchange rate empty for full
01.10.2025
easy1518. Water Bottles
Total drinks with exchange empty for full
30.09.2025
medium2221. Find Triangular Sum of an Array
Triangle sum % 10
29.09.2025
medium1039. Minimum Score Triangulation of Polygon
Min sum of triangle product for every possible triangulation
28.09.2025
easy976. Largest Perimeter Triangle
Max triangle perimeter from array of lengths window
27.09.2025
easy812. Largest Triangle Area
Max area triangle
26.09.2025
medium611. Valid Triangle Number
Count triangles can be made from numbers search sum
25.09.2025
medium120. Triangle
Min path sum in triangle
24.09.2025
medium166. Fraction to Recurring Decimal
Calc a/b to string x.y(z)
23.09.2025
medium165. Compare Version Numbers
Compare versions x.x.x.x
22.09.2025
easy3005. Count Elements With Maximum Frequency
Count max-freq elements
21.09.2025
medium1912. Design Movie Rental System
Design Movie Rent: rent,drop,search(5 lowest), report(5 lowest rented)
20.09.2025
medium3508. Implement Router
Design Router: addPacket, forwardPacket, getCount(dst, ts start..end)
19.09.2025
medium3484. Design Spreadsheet
Design Spreadsheet: setCell, resetCell, getValue(a+b)
18.09.2025
medium3408. Design Task Manager
Design Scheduler: add, edit, remove, execute by priority
17.09.2025
medium2353. Design a Food Rating System
Food rating system: change rating, peek highest by type
16.09.2025
hard2197. Replace Non-Coprime Numbers in Array
Simulate gcd to lcm adjacent pair removal
15.09.2025
easy1935. Maximum Number of Words You Can Type
Count words with all letters
14.09.2025
medium966. Vowel Spellchecker
Spellcheck with priority: original, case, vowels
13.09.2025
easy3541. Find Most Frequent Vowel and Consonant
Max freq vowels + consonants
12.09.2025
medium3227. Vowels Game in a String
Can Alice win Bob both removeing odd-even vowel count substring optimally
11.09.2025
medium2785. Sort Vowels in a String
Sort vowels
10.09.2025
medium1733. Minimum Number of People to Teach
Min friends to teach common language to communicate in graph
09.09.2025
medium2327. Number of People Aware of a Secret
People knowing a secret at day n, keeping delay then spread and forget
08.09.2025
easy1317. Convert Integer to the Sum of Two No-Zero Integers
Find a+b=n without zeros in digits
07.09.2025
easy1304. Find N Unique Integers Sum up to Zero
Any n uniq numbers with sum of 0
06.09.2025
hard3495. Minimum Operations to Make Array Elements Zero
Sum query [a..b] of optimal pairwise /4 until range is zero
05.09.2025
medium2749. Minimum Operations to Make the Integer Zero
Min ops to subtract n2+2^(0..60) from n1 and make n1=0
04.09.2025
easy3516. Find Closest Person
Compare two distances
03.09.2025
hard3027. Find the Number of Ways to Place People II
Left-top, bottom-right pairs with empty rectangles
02.09.2025
medium3025. Find the Number of Ways to Place People I
Left-top, bottom-right pairs with empty rectangles
01.09.2025
medium1792. Maximum Average Pass Ratio
Max avg ratio after assigning extra to ratios
31.08.2025
hard37. Sudoku Solver
Solve sudoku
30.08.2025
medium36. Valid Sudoku
Validate sudoku has no duplicates
29.08.2025
medium3021. Alice and Bob Playing Flower Game
Pairs x=1..n y=1..m for Alice to win in take from (x+y) game
28.08.2025
medium3446. Sort Matrix by Diagonals
Sort bottom left and top right diagonals
27.08.2025
hard3459. Length of Longest V-Shaped Diagonal Segment
Max length of 1-2-0-2.. diagonal sequence, on cw rotation
26.08.2025
medium3000. Maximum Area of Longest Diagonal Rectangle
Max area of max diagonal rectangles
25.08.2025
medium498. Diagonal Traverse
Matrix diagonal traversal
24.08.2025
medium1493. Longest Subarray of 1's After Deleting One Element
Max 1-subarray after removing one elemnt pointers
23.08.2025
hard3197. Find the Minimum Area to Cover All Ones II
Min sum all-1 areas of 3-split
22.08.2025
medium3195. Find the Minimum Area to Cover All Ones I
Min all-1 rectangle
21.08.2025
medium1504. Count Submatrices With All Ones
Count islands of 1
20.08.2025
medium1277. Count Square Submatrices with All Ones
Count square islands of 1
19.08.2025
medium2348. Number of Zero-Filled Subarrays
Count 0-subarrays
18.08.2025
hard679. 24 Game
Can a,b,c,d = 24 with ops /+-()
17.08.2025
medium837. New 21 Game
Probability sum of random(1..m) less than n when stop adding at k
16.08.2025
easy1323. Maximum 69 Number
Bigger number by replacing 6 to 9
15.08.2025
easy342. Power of Four
Is number power of 4?
14.08.2025
easy2264. Largest 3-Same-Digit Number in String
Max 3-digit in string
13.08.2025
easy326. Power of Three
Is n power of 3?
12.08.2025
medium2787. Ways to Express an Integer as Sum of Powers
Ways to make n by sum of a^x+b^x+...
11.08.2025
medium2438. Range Product Queries of Powers
Range product queries of powers of two from n
10.08.2025
medium869. Reordered Power of 2
Rearrange digits to make power of two
9.08.2025
easy231. Power of Two
Is int 32 power of 2?
8.08.2025
medium808. Soup Servings
Probability A empty first plus both empty /2
7.08.2025
hard3363. Find the Maximum Number of Fruits Collected
Max 3 paths from corners to bottom end
6.08.2025
medium3479. Fruits Into Baskets III
Place fruits left to right to first available bucket tree
5.08.2025
easy3477. Fruits Into Baskets II
Place fruits left to right to first available bucket
4.08.2025
medium904. Fruit Into Baskets
Max consequent two-types range
3.08.2025
hard2106. Maximum Fruits Harvested After at Most K Steps
Max values k steps from start point window
2.08.2025
hard2561. Rearranging Fruits
Min swaps cost to make a==b
1.08.2025
easy118. Pascal's Triangle
Pascal's Triangle
31.07.2025
medium898. Bitwise ORs of Subarrays
Uniq OR-subarrays
30.07.2025
medium2419. Longest Subarray With Maximum Bitwise AND
Longest max OR subarray
29.07.2025
medium2411. Smallest Subarrays With Maximum Bitwise OR
Shortest max OR i.. subarrays pointers
28.07.2025
medium2044. Count Number of Maximum Bitwise-OR Subsets
Subsequencies with max OR
27.07.2025
easy2210. Count Hills and Valleys in an Array
Count hills and valleys
26.07.2025
hard3480. Maximize Subarrays After Removing One Conflicting Pair
Max subarrays count without excluded pairs-1 sweep
25.07.2025
easy3487. Maximum Unique Subarray Sum After Deletion
Max non-empty uniq subsequence sum
24.07.2025
hard2322. Minimum Score After Removals on a Tree
Min(max group xor - min group xor) by removing 2 edges from tree
23.07.2025
medium1717. Maximum Score From Removing Substrings
Max removals ab=x, ba=y
22.07.2025
medium1695. Maximum Erasure Value
Max unique subarray sum window
21.07.2025
easy1957. Delete Characters to Make Fancy String
No three chars repeats
20.07.2025
hard1948. Delete Duplicate Folders in System
Remove duplicate folder trees
19.07.2025
hard1233. Remove Sub-Folders from the Filesystem
Fold folders
18.07.2025
hard2163. Minimum Difference in Sums After Removal of Elements
Min first half - second half after removing n/3
17.07.2025
medium3202. Find the Maximum Length of Valid Subsequence II
Longest same-pair-k-parity subsequence
16.07.2025
medium3201. Find the Maximum Length of Valid Subsequence I
Longest same-pair-parity subsequence
14.07.2025
easy1290. Convert Binary Number in a Linked List to Integer
Binary linked list to decimal
13.07.2025
medium2410. Maximum Matching of Players With Trainers
Count trainers for players
12.07.2025
hard1900. The Earliest and Latest Rounds Where Players Compete
First and last round Alice fight Bob
11.07.2025
hard2402. Meeting Rooms III
Most frequent meeting room
10.07.2025
medium3440. Reschedule Meetings for Maximum Free Time II
Max free time after moving 1 event
9.07.2025
medium3439. Reschedule Meetings for Maximum Free Time I
Max free time after moving k events together window
8.07.2025
hard1751. Maximum Number of Events That Can Be Attended II
Max top k valued intervals search
7.07.2025
medium1353. Maximum Number of Events That Can Be Attended
Max attended events
6.07.2025
medium1865. Finding Pairs With a Certain Sum
Design pairs counter; two lists, one changes
5.07.2025
easy1394. Find Lucky Integer in an Array
Max x == freq(x)
4.07.2025
hard3307. Find the K-th Character in String Game II
kth char in double+shift by ops[i] string manipulation
3.07.2025
easy3304. Find the K-th Character in String Game I
kth char after appending rotated self
2.07.2025
hard3333. Find the Original Typed String II
ways to remove duplicates, preserve length at least k
30.06.2025
easy594. Longest Harmonious Subsequence
Longest subsequence with max-min=1 pointers
29.06.2025
medium1498. Number of Subsequences That Satisfy the Given Sum Condition
Subsequencies target in 0..min+max search pointers
28.06.2025
easy2099. Find Subsequence of Length K With the Largest Sum
Subsequence of k largest
27.06.2025
hard2014. Longest Subsequence Repeated k Times
Longest k-repeating subsequence
26.06.2025
medium2311. Longest Binary Subsequence Less Than or Equal to K
Longest binary subsequence less than K
25.06.2025
hard2040. Kth Smallest Product of Two Sorted Arrays
K-th increasing product from two arrays search
24.06.2025
easy2200. Find All K-Distant Indices in an Array
Indices k-distant to key
23.06.2025
hard2081. Sum of k-Mirror Numbers
n palindromes in both 10 and k-base
22.06.2025
easy2138. Divide a String Into Groups of Size k
k-chunked string, filled tail
21.06.2025
medium3085. Minimum Deletions to Make String K-Special
Min remove to make frequencies k-narrow
20.06.2025
medium3443. Maximum Manhattan Distance After K Changes
Max distance after k flips
19.06.2025
medium2294. Partition Array Such That Maximum Difference Is K
k-narrow subsequences
18.06.2025
medium2966. Divide Array Into Arrays With Max Difference
List of k-narrow tripplets
17.06.2025
hard3405. Count the Number of Arrays with K Matching Adjacent Elements
Combinations k equal siblings 1..m in [n] array
16.06.2025
easy2016. Maximum Difference Between Increasing Elements
Max increasing pair diff
15.06.2025
medium1432. Max Difference You Can Get From Changing an Integer
Max - min, replacing any digit, no leading zeros
14.06.2025
easy2566. Maximum Difference by Remapping a Digit
Max - min, replacing any digit
13.06.2025
medium2616. Minimize the Maximum Difference of Pairs
Min max diffs non-overlapped pairs search
12.06.2025
easy3423. Maximum Difference Between Adjacent Elements in a Circular Array
Max abs sibling diff
11.06.2025
hard3445. Maximum Difference Between Even and Odd Frequency II
Max odd - min even frequency, window at least k
10.06.2025
easy3442. Maximum Difference Between Even and Odd Frequency I
Max odd - min even frequency
09.06.2025
hard440. K-th Smallest in Lexicographical Order
k-th lexicographical number of 1..n
08.06.2025
medium386. Lexicographical Numbers
Generate lexicographical numbers 1..n
07.06.2025
medium3170. Lexicographically Minimum String After Removing Stars
Smallest string by remove min to the left of
06.06.2025
medium2434. Using a Robot to Print the Lexicographically Smallest String
Smallest string by writing to stack
05.06.2025
medium1061. Lexicographically Smallest Equivalent String
Map by smallest in group from associate s1 with s2
04.06.2025
medium3403. Find the Lexicographically Largest String From the Box I
Max string of every split by n
03.06.2025
hard1298. Maximum Candies You Can Get from Boxes
Open boxes graph with keys simulation
02.06.2025
hard135. Candy
Min candies, fair siblings by ratings
01.06.2025
medium2929. Distribute Candies Among Children II
Ways to give limited from n candies to 3 kids
31.05.2025
medium909. Snakes and Ladders
Shortest path bottom-top in zig-zag matrix with jumps
30.05.2025
medium2359. Find Closest Node to Given Two Nodes
Closest common node
29.05.2025
hard3373. Maximize the Number of Target Nodes After Connecting Trees II
Max even-edged siblings after merging trees
28.05.2025
medium3372. Maximize the Number of Target Nodes After Connecting Trees I
Max k-reachable nodes of merged trees
27.05.2025
easy2894. Divisible and Non-divisible Sums Difference
Sum non-divisible minus sum divisible
26.05.2025
hard1857. Largest Color Value in a Directed Graph
Max color freq path
25.05.2025
medium2131. Longest Palindrome by Concatenating Two Letter Words
Max palindrome length from 2 char words
24.05.2025
easy2942. Find Words Containing Character
Indices with x
23.05.2025
hard3068. Find the Maximum Sum of Node Values
Max sum by k-xoring edges
22.05.2025
medium3362. Zero Array Transformation III
Max removed queries still zero-fy an array
21.05.2025
medium73. Set Matrix Zeroes
Zero-fy rows and columns
20.05.2025
medium3355. Zero Array Transformation I
Can intersecting intervals decrease an array sweep
19.05.2025
easy3024. Type of Triangle
Triangle type by lengths
18.05.2025
hard1931. Painting a Grid With Three Different Colors
Ways to 3-color m n grid, no adjucents
17.05.2025
medium75. Sort Colors
Sort 0,1,2 array pointers
16.05.2025
medium2901. Longest Unequal Adjacent Groups Subsequence II
Longest subsequence humming distance 1, alterating groups
15.05.2025
easy2900. Longest Unequal Adjacent Groups Subsequence I
Longest subsequence alterating g
14.05.2025
hard3337. Total Characters in String After Transformations II
t steps to convert char into next nums[c] chars
13.05.2025
medium3335. Total Characters in String After Transformations I
String length after t shifts c=c+1,z=ab
12.05.2025
easy2094. Finding 3-Digit Even Numbers
Triple digit even numbers from digits
11.05.2025
easy1550. Three Consecutive Odds
odds
10.05.2025
medium2918. Minimum Equal Sum of Two Arrays After Replacing Zeros
Min equal array sum, fill zeros
09.05.2025
hard3343. Count Number of Balanced Permutations
Permutations of even-odd position sums equal
08.05.2025
medium3342. Find Minimum Time to Reach Last Room II
Fastest travel in graph, alternating dt=1,2
07.05.2025
medium3341. Find Minimum Time to Reach Last Room I
Fastest path in graph
06.05.2025
easy1920. Build Array from Permutation
n[n[i]]
05.05.2025
medium790. Domino and Tromino Tiling
Ways to fill 2xn board with I,L shapes
04.05.2025
easy1128. Number of Equivalent Domino Pairs
Dominoes pairs
03.05.2025
medium1007. Minimum Domino Rotations For Equal Row
Min swaps to make a top or bottom row
02.05.2025
medium838. Push Dominoes
Dominoes simulation
01.05.2025
hard2071. Maximum Number of Tasks You Can Assign
Tasks can be done by workers with pills search
30.04.2025
easy1295. Find Numbers with Even Number of Digits
Even length numbers
29.04.2025
medium2962. Count Subarrays Where Max Element Appears at Least K Times
Subarrays at least k maxes pointers
28.04.2025
hard2302. Count Subarrays With Score Less Than K
Subarrays sum cnt <= k pointers
27.04.2025
easy3392. Count Subarrays of Length Three With a Condition
subarrays 2a + 2c == b
26.04.2025
hard2444. Count Subarrays With Fixed Bounds
Subarrays with min=minK, max=maxK pointers
25.04.2025
medium2845. Count of Interesting Subarrays
Subarrays, count a[i]%m=k is c%m=k map
24.04.2025
medium2799. Count Complete Subarrays in an Array
Subarrays having all uniqs pointers
23.04.2025
easy1399. Count Largest Group
Count of max groups by digits sum 1..n
22.04.2025
hard2338. Count the Number of Ideal Arrays
Arrays a[i] % a[i - 1] == 0, i..n, a[i]..max
21.04.2025
medium2145. Count the Hidden Sequences
Possible arrays from diff array and lo..hi
20.04.2025
medium781. Rabbits in Forest
Count total rabbits from other numbers
19.04.2025
medium2563. Count the Number of Fair Pairs
Pairs a + b in lower..upper pointers
18.04.2025
medium38. Count and Say
nth run-length encoded string
17.04.2025
easy2176. Count Equal and Divisible Pairs in an Array
Pairs a[i] == b[j], i j % k == 0
16.04.2025
medium2537. Count the Number of Good Subarrays
Subarrays with at least k equal pairs window
15.04.2025
hard2179. Count Good Triplets in an Array
Triplets in same order in both (0..n)-arrays
14.04.2025
easy1534. Count Good Triplets
Triplets with diff less than a,b,c
13.04.2025
medium1922. Count Good Numbers
Count (0,2,4,6,8)(2,3,5,7) generated strings of length n
12.04.2025
hard3272. Find the Count of Good Integers
Count palindromes of length n, divisible by k
11.04.2025
easy2843. Count Symmetric Integers
Numbers with equal half' sums
10.04.2025
hard2999. Count the Number of Powerful Integers
Numbers in range start..finish, digits up to limit
09.04.2025
easy3375. Minimum Operations to Make Array Values Equal to K
Count number bigger than k
08.04.2025
easy3396. Minimum Number of Operations to Make Elements in Array Distinct
Count removals 3-prefixes to deduplicate
07.04.2025
medium416. Partition Equal Subset Sum
Two equal sum subsets
06.04.2025
medium368. Largest Divisible Subset
Longest all pairs divisible subset
05.04.2025
easy1863. Sum of All Subset XOR Totals
Sum of all subsets xors
04.04.2025
medium1123. Lowest Common Ancestor of Deepest Leaves
Lowest common ancestor of deepest tree nodes
03.04.2025
medium2874. Maximum Value of an Ordered Triplet II
Max (a[i] - a[j]) a[k]
02.04.2025
easy2873. Maximum Value of an Ordered Triplet I
Max (a[i] - a[j]) a[k]
01.04.2025
medium2140. Solving Questions With Brainpower
Max sum of (points, skip next) pairs
31.03.2025
hard2551. Put Marbles in Bags
Max split sum - min split sum of borders
30.03.2025
medium763. Partition Labels
Split string into separate chars sets
29.03.2025
hard2818. Apply Operations to Maximize Score
Multiply k numbers with max prime factor count stack
28.03.2025
hard2503. Maximum Number of Points From Grid Queries
Running queries of increasing BFS
27.03.2025
medium2780. Minimum Index of a Valid Split
Min split index to have equal majority elements
26.03.2025
medium2033. Minimum Operations to Make a Uni-Value Grid
Min sum of differences of x times
25.03.2025
medium3394. Check if Grid can be Cut into Sections
non-intersecting ranges on x or y axis sweep
24.03.2025
medium3169. Count Days Without Meetings
Days of non-intersecting intervals sweep
23.03.2025
medium1976. Number of Ways to Arrive at Destination
Count optimal paths from 0 to n - 1 ford
22.03.2025
medium2685. Count the Number of Complete Components
Count fully connected components
21.03.2025
medium2115. Find All Possible Recipes from Given Supplies
Valid recipes from supplies
20.03.2025
hard3108. Minimum Cost Walk in Weighted Graph
Min AND of path weights manipulation
19.03.2025
medium3191. Minimum Operations to Make Binary Array Elements Equal to One I
bits flips to make all 1 manipulation
18.03.2025
medium2401. Longest Nice Subarray
Max window of all pairs AND zero pointers manipulation
17.03.2025
easy2206. Divide Array Into Equal Pairs
All numbers in pairs
16.03.2025
medium2594. Minimum Time to Repair Cars
Min rank[i] count^2 to fix all cars search
15.03.2025
medium2560. House Robber IV
Min-max of non-adjucents in array search
14.03.2025
medium2226. Maximum Candies Allocated to K Children
Distribute candies to k equal buckets search
13.03.2025
medium3356. Zero Array Transformation II
Min queries (l..r, v) to decrease nums by v to 0 sweep
12.03.2025
easy2529. Maximum Count of Positive Integer and Negative Integer
Max positive count or negative count search
11.03.2025
medium1358. Number of Substrings Containing All Three Characters
Substrings with [abc] pointers
10.03.2025
medium3306. Count of Substrings Containing Every Vowel and K Consonants II
Substring with all vowels and k others pointers
09.03.2025
medium3208. Alternating Groups II
Count cycling alterating k-subarrays pointers
08.03.2025
easy2379. Minimum Recolors to Get K Consecutive Black Blocks
Min 'W' flips to make k 'B' window
07.03.2025
medium2523. Closest Prime Numbers in Range
Min diff primes pair in left..right
06.03.2025
easy2965. Find Missing and Repeated Values
Missing and repeated in 1..n array
05.03.2025
medium2579. Count Total Number of Colored Cells
Arithmetic sum
04.03.2025
medium1780. Check if Number is a Sum of Powers of Three
Number as the sum of distinct powers of 3
03.03.2025
medium2161. Partition Array According to Given Pivot
Partition around p
02.03.2025
easy2570. Merge Two 2D Arrays by Summing Values
Merge two ascending [key, value] lists
01.03.2025
easy2460. Apply Operations to an Array
If a[i] == a[i + 1], a[i] = 2, a[i + 1] = 0
28.02.2025
hard1092. Shortest Common Supersequence
Shortest string with both subsequences
27.02.2025
medium873. Length of Longest Fibonacci Subsequence
Longest sequence a, b, a + b programming
26.02.2025
medium1749. Maximum Absolute Sum of Any Subarray
Max abs of subarray sum sum
25.02.2025
medium1524. Number of Sub-arrays With Odd Sum
Count odd sum subarrays sum
24.02.2025
medium2467. Most Profitable Path in a Tree
Max Alice path down, Bob up in tree
23.02.2025
medium889. Construct Binary Tree from Preorder and Postorder Traversal
Tree from preorder & postorder
22.02.2025
hard1028. Recover a Tree From Preorder Traversal
Recover binary tree from depth-dashes string
21.02.2025
medium1261. Find Elements in a Contaminated Binary Tree
Is number in a tree 2 v+(1L, 2R)?
20.02.2025
medium1980. Find Unique Binary String
Binary number not in a set
19.02.2025
medium1415. The k-th Lexicographical String of All Happy Strings of Length n
kth string of abc permutations
18.02.2025
medium2375. Construct Smallest Number From DI String
Smallest number from 1..9 and Inc-Dec pattern
17.02.2025
medium1079. Letter Tile Possibilities
Count uniq sequences from letters
16.02.2025
medium1718. Construct the Lexicographically Largest Valid Sequence
Construct array x = 1..n, a[i] = x, a[i + x] = x
15.02.2025
medium2698. Find the Punishment Number of an Integer
Sum x^2 if it's string partition sum = x
14.02.2025
medium1352. Product of the Last K Numbers
Running suffix product product
13.02.2025
medium3066. Minimum Operations to Exceed Threshold Value II
Count nums += min(x,y) 2+max(x,y) < k
12.02.2025
medium2342. Max Sum of a Pair With Equal Sum of Digits
Max pairs sum with equal digits sum
11.02.2025
medium1910. Remove All Occurrences of a Substring
Remove substring recursively
10.02.2025
easy3174. Clear Digits
Remove [char][digit] pairs from string
09.02.2025
medium2364. Count Number of Bad Pairs
Count pairs a[i] - a[j] != j - i
08.02.2025
medium2349. Design a Number Container System
Smallest running index of number in map
07.02.2025
medium3160. Find the Number of Distinct Colors Among the Balls
Running colors counter
06.02.2025
medium1726. Tuple with Same Product
Count uniq 4-tupples a b=c d
05.02.2025
easy1790. Check if One String Swap Can Make Strings Equal
One swap to make stings equal
04.02.2025
easy1800. Maximum Ascending Subarray Sum
Max increasing subarray sum
03.02.2025
easy3105. Longest Strictly Increasing or Strictly Decreasing Subarray
Longest strict monotonic subarray
02.02.2025
easy1752. Check if Array Is Sorted and Rotated
Is array sorted and rotated?
01.02.2025
easy3151. Special Array I
All siblings even-odd
31.01.2025
hard827. Making A Large Island
Max area after filling one empty 2D grid cell find
30.01.2025
hard2493. Divide Nodes Into the Maximum Number of Groups
Max count of bipartitions in a graph
29.01.2025
medium684. Redundant Connection
First edge making a cycle in graph find
28.01.2025
medium2658. Maximum Number of Fish in a Grid
Largest region in 2D grid
27.01.2025
medium1462. Course Schedule IV
All innodes for each query in graph warshall
26.01.2025
hard2127. Maximum Employees to Be Invited to a Meeting
Max connected siblings in graph
25.01.2025
medium2948. Make Lexicographically Smallest Array by Swapping Elements
Sort by swapping ab, where abs(a - b) < limit
24.01.2025
medium802. Find Eventual Safe States
Nodes without cycles
23.01.2025
medium1267. Count Servers that Communicate
Connected servers by row or column
22.01.2025
medium1765. Map of Highest Peak
Make growing landscape
21.01.2025
medium2017. Grid Game
Maximum of minimized paths sum
20.01.2025
medium2661. First Completely Painted Row or Column
Index of the first filled row/column in 2D matrix
19.01.2025
hard407. Trapping Rain Water II
Trap the water in 2D height matrix
18.01.2025
hard1368. Minimum Cost to Make at Least One Valid Path in a Grid
Min undirected jumps to reach the end in grid
17.01.2025
medium2683. Neighboring Bitwise XOR
Can restore next-sibl-xored array?
16.01.2025
medium2425. Bitwise XOR of All Pairings
Xor of all pairs xors
15.01.2025
medium2429. Minimize XOR
Min xor with num1, bits count of num2
14.01.2025
medium2657. Find the Prefix Common Array of Two Arrays
A[..i] and B[..i] intersections sizes
13.01.2025
medium3223. Minimum Length of String After Operations
Length after removing repeatings > 2
12.01.2025
medium2116. Check if a Parentheses String Can Be Valid
Balance parenthesis with wildcards
11.01.2025
medium1400. Construct K Palindrome Strings
Can make k palindromes from string?
10.01.2025
medium916. Word Subsets
Words containing all chars of words2
09.01.2025
easy2185. Counting Words With a Given Prefix
Count words with prefix
08.01.2025
easy3042. Count Prefix and Suffix Pairs I
Count prefix-suffix matched pairs
07.01.2025
easy1408. String Matching in an Array
All substrings
06.01.2025
medium1769. Minimum Number of Operations to Move All Balls to Each Box
Sum distances to all 1 for every position sum
05.01.2025
medium2381. Shifting Letters II
Apply from..to, direction shifts to string chars sweep
04.01.2025
medium1930. Unique Length-3 Palindromic Subsequences
Count palindromes of length 3
03.01.2025
medium2270. Number of Ways to Split Array
Count splits left sum >= right sum sum
02.01.2025
medium2559. Count Vowel Strings in Ranges
Count words[q[0]..q[1]] starting and ending with "aeiou"
01.01.2025
easy1422. Maximum Score After Splitting a String
Max(left zeros + right ones)
31.12.2024
medium983. Minimum Cost For Tickets
Min sum buying 1,7,30-days tickets to travel all days programming
30.12.2024
medium2466. Count Ways To Build Good Strings
Ways to make 01-string length of low..high programming
29.12.2024
hard1639. Number of Ways to Form a Target String Given a Dictionary
Ways to make target with increasing positions in words programming
28.12.2024
hard689. Maximum Sum of 3 Non-Overlapping Subarrays
max non-intersecting intervals programming window
27.12.2024
medium1014. Best Sightseeing Pair
Max (a[i] + a[j] + i - j), i > j
26.12.2024
medium494. Target Sum
Count signs permutations to sum equal target programming
25.12.2024
medium515. Find Largest Value in Each Tree Row
Tree layers maxes
24.12.2024
hard3203. Find Minimum Diameter After Merging Two Trees
Diameter of 2 connected trees
23.12.2024
medium2471. Minimum Number of Operations to Sort a Binary Tree by Level
Min swaps to sort tree layers
22.12.2024
hard2940. Find Building Where Alice and Bob Can Meet
Common indices t, h[t] > h[a], h[t] > h[b] for queries q[][a,b] stack
21.12.2024
hard2872. Maximum Number of K-Divisible Components
Max connected components divisible by k in graph
20.12.2024
medium2415. Reverse Odd Levels of Binary Tree
Odd-levels reversal in a perfect tree
19.12.2024
medium769. Max Chunks To Make Sorted
Maximum independent chunks to merge-sort array
18.12.2024
easy1475. Final Prices With a Special Discount in a Shop
Subtract next smaller value stack
17.12.2024
medium2182. Construct String With Repeat Limit
Max lexical ordered with repeat limit string sort
16.12.2024
easy3264. Final Array State After K Multiplication Operations I
Mutliply k minimums
15.12.2024
medium1792. Maximum Average Pass Ratio
Arrange passed students to improve average score
14.12.2024
medium2762. Continuous Subarrays
Count subarrays with difference <= 2 queue set
13.12.2024
medium2593. Find Score of an Array After Marking All Elements
Sum of minimums in order excluding siblings stack
12.12.2024
medium2558. Take Gifts From the Richest Pile
Sum after k-Sqrt of tops in array
11.12.2024
medium2779. Maximum Beauty of an Array After Applying Operation
Max equal nums after adjusting to [-k..+k] search sweep
10.12.2024
medium2981. Find Longest Special Substring That Occurs Thrice I
Max same-char 3-windows length window
09.12.2024
medium3152. Special Array II
Queries is all adjucents parity differ [i..j] pointers
08.12.2024
medium2054. Two Best Non-Overlapping Events
Max two non-overlapping intervals search
07.12.2024
medium1760. Minimum Limit of Balls in a Bag
Max number after at most maxOperations of splitting search
06.12.2024
medium2554. Maximum Number of Integers to Choose From a Range I
Sum 1..n excluding banned until maxSum
05.12.2024
medium2337. Move Pieces to Obtain a String
Move L left and R right to match strings
04.12.2024
medium2825. Make String a Subsequence Using Cyclic Increments
Increase some chars once to make a subsequence
03.12.2024
medium2109. Adding Spaces to a String
Insert spaces into string
02.12.2024
easy1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence
Position of the prefix
01.12.2024
easy1346. Check If N and Its Double Exist
Any i != j && a[i] = 2 a[j]
30.11.2024
hard2097. Valid Arrangement of Pairs
Hierholzer algorithm
29.11.2024
hard2577. Minimum Time to Visit a Cell In a Grid
Min time start-end 4-d travel in 2D matrix with waiting
28.11.2024
hard2290. Minimum Obstacle Removal to Reach Corner
Min removals to travel first-last in 2D grid
27.11.2024
medium3243. Shortest Distance After Road Addition Queries I
Query shortest paths after adding new edges
26.11.2024
medium2924. Find Champion II
Root of the graph
25.11.2024
hard773. Sliding Puzzle
Steps to solve slide puzzle
24.11.2024
medium1975. Maximum Matrix Sum
Max sum of 2D matrix after multiply by -1 adjacent cells
23.11.2024
medium1861. Rotating the Box
Rotate matrix and simulate the fall
22.11.2024
medium1072. Flip Columns For Maximum Number of Equal Rows
Max same-bit-rows after flipping columns in 01-2D matrix
21.11.2024
medium2257. Count Unguarded Cells in the Grid
Count unseen cells in 2D matrix with guards and walls
20.11.2024
medium2516. Take K of Each Character From Left and Right
Min take k of a,b,c from head or tail pointers
19.11.2024
medium2461. Maximum Sum of Distinct Subarrays With Length K
Max k-unique window sum window
18.11.2024
easy1652. Defuse the Bomb
Next +-k window sums window
17.11.2024
hard862. Shortest Subarray with Sum at Least K
Min subarray with sum at least k queue
16.11.2024
medium3254. Find the Power of K-Size Subarrays I
Tops of consecutive increasing windows window
15.11.2024
medium1574. Shortest Subarray to be Removed to Make Array Sorted
Min subarray remove to make array sorted pointers
14.11.2024
medium2064. Minimized Maximum of Products Distributed to Any Store
Min of max of quantities spread by n single-type stores search
13.11.2024
medium2563. Count the Number of Fair Pairs
Count pairs a[i] + a[j] in lower..upper search pointers
12.11.2024
medium2070. Most Beautiful Item for Each Query
Queries of max beauty for q[i] price search
11.11.2024
medium2601. Prime Subtraction Operation
Increased sequence by subtracting primes? search
10.11.2024
medium3097. Shortest Subarray With OR at Least K II
Min subarray with OR[..] >= k manipulation window
09.11.2024
medium3133. Minimum Array End
nth of increasing sequence with AND[..]=x manipulation
08.11.2024
medium1829. Maximum XOR for Each Query
Running xor to make 2^k-1 manipulation
07.11.2024
medium2275. Largest Combination With Bitwise AND Greater Than Zero
Max positive AND-subset manipulation
06.11.2024
medium3011. Find if Array Can Be Sorted
Can array be sorted by adjacent swap same-1-bits-nums
05.11.2024
medium2914. Minimum Number of Changes to Make Binary String Beautiful
Min changes to make even-sized 0 and 1
04.11.2024
medium3163. String Compression III
Compress repeating chars in string pointers
03.11.2024
easy796. Rotate String
Is string rotated goal?
02.11.2024
easy2490. Circular Sentence
Are words circular?
01.11.2024
easy1957. Delete Characters to Make Fancy String
Filter 3+ repeating chars from string
31.10.2024
hard2463. Minimum Total Distance Traveled
Min robots[x] travel to factories[x,capacity] programming
30.10.2024
hard1671. Minimum Number of Removals to Make Mountain Array
Min removes to make a mountain programming search
29.10.2024
medium2684. Maximum Number of Moves in a Grid
Max increasing path from left to right in 2D matrix programming
28.10.2024
medium2501. Longest Square Streak in an Array
Longest quadratic subset
27.10.2024
medium1277. Count Square Submatrices with All Ones
Count 1-filled squares in 2D matrix programming
26.10.2024
hard2458. Height of Binary Tree After Subtree Removal Queries
n new heights by cutting nodes in a Tree
25.10.2024
medium1233. Remove Sub-Folders from the Filesystem
Remove empty subfolders
24.10.2024
medium951. Flip Equivalent Binary Trees
Are trees flip-equal
23.10.2024
medium2641. Cousins in Binary Tree II
Replace Tree's values with cousines sum
22.10.2024
medium2583. Kth Largest Sum in a Binary Tree
kth largest level-sum in a tree
21.10.2024
medium1593. Split a String Into the Max Number of Unique Substrings
Max count of unique split parts
20.10.2024
hard1106. Parsing A Boolean Expression
before evaluation, index i should point at the first token of the subproblem
19.10.2024
medium1545. Find Kth Bit in Nth Binary String
kth bit of sequence bs[i] = bs[i-1] + '1' + rev(inv(bs[i-1])) manipulation
18.10.2024
medium2044. Count Number of Maximum Bitwise-OR Subsets
Count subsequences with max bitwise or
17.10.2024
medium670. Maximum Swap
Max number after a single digits swap
16.10.2024
medium1405. Longest Happy String
Longest string of a, b, c not repeating 3 times
15.10.2024
medium2938. Separate Black and White Balls
Min moves to sort 01 string
14.10.2024
medium2530. Maximal Score After Applying K Operations
Replace max(arr) with ceil(max/3) k times
13.10.2024
hard632. Smallest Range Covering Elements from K Lists
Smallest intersection of k sorted lists set
12.10.2024
medium2406. Divide Intervals Into Minimum Number of Groups
Count non-intersecting groups of intervals
11.10.2024
medium1942. The Number of the Smallest Unoccupied Chair
target's chair number when chairs reused by multiple [arrival, leave] times
10.10.2024
medium962. Maximum Width Ramp
Max j-i between a[i] <= a[j] in an array stack
09.10.2024
medium921. Minimum Add to Make Parentheses Valid
Minimum inserts to balance brackets
08.10.2024
medium1963. Minimum Number of Swaps to Make the String Balanced
Min swaps to balance brackets pointers
07.10.2024
easy2696. Minimum String Length After Removing Substrings
Remove 'AB' and 'CD' from the string
06.10.2024
medium1813. Sentence Similarity III
Are strings equal after inserting substring?
05.10.2024
medium567. Permutation in String
Is s2 contains permutation of s1? pointers
04.10.2024
medium2491. Divide Players Into Teams of Equal Skill
Sum of products of pairs with equal sums
03.10.2024
medium1590. Make Sum Divisible by P
Min removed subarray length to make remainder % p = 0
02.10.2024
easy1331. Rank Transform of an Array
Array values to their sorted set positions
01.10.2024
medium1497. Check If Array Pairs Are Divisible by k
Can all pairs sums be k-even?
30.09.2024
medium1381. Design a Stack With Increment Operation
Stack with range increment operation
29.09.2024
hard432. All O`one Data Structure
Count usage frequencies in O(1) list
28.09.2024
medium641. Design Circular Deque
Ring buffer
27.09.2024
medium731. My Calendar II
Add intervals intersecting less than two times sweep
26.09.2024
medium729. My Calendar I
Insert non-intersection interval search
25.09.2024
hard2416. Sum of Prefix Scores of Strings
Counts of words with same prefixes
24.09.2024
medium3043. Find the Length of the Longest Common Prefix
Common digit prefix between all pairs of two num arrays
23.09.2024
hard2707. Extra Characters in a String
Min extra chars to form an s from dictionary programming
22.09.2024
hard440. K-th Smallest in Lexicographical Order
k lexicographically smallest value from 1..n
21.09.2024
medium386. Lexicographical Numbers
Lexicographical ordered numbers 1..n
20.09.2024
hard214. Shortest Palindrome
Prepend to make the shortest palindrome hash
19.09.2024
medium241. Different Ways to Add Parentheses
Eval all possible parenthesis placements programming
18.09.2024
medium179. Largest Number
Concatenate nums to largest number
17.09.2024
easy884. Uncommon Words from Two Sentences
Unique words from two strings
16.09.2024
medium539. Minimum Time Difference
Min difference in a list of times hh:mm
15.09.2024
medium1371. Find the Longest Substring Containing Vowels in Even Counts
Longest substring with even number of "aeiou" manipulation pointers
14.09.2024
medium2419. Longest Subarray With Maximum Bitwise AND
Max bitwise AND subarray manipulation pointers
13.09.2024
medium1310. XOR Queries of a Subarray
Run queries[[from, to]] of xor(arr[from..to]) manipulation
12.09.2024
easy1684. Count the Number of Consistent Strings
Count words with allowed characters
11.09.2024
easy2220. Minimum Bit Flips to Convert Number
Bit diff between two numbers manipulation
10.09.2024
medium2807. Insert Greatest Common Divisors in Linked List
Insert gcd in-between LinkedList nodes list
09.09.2024
medium2326. Spiral Matrix IV
LinkedList to spiral 2D matrix list
08.09.2024
medium725. Split Linked List in Parts
Split LinkedList into k parts list
07.09.2024
medium1367. Linked List in Binary Tree
Is the LinkedList in the BinaryTree? list
06.09.2024
medium3217. Delete Nodes From Linked List Present in Array
Remove nums from a Linked List list
05.09.2024
medium2028. Find Missing Observations
Find n numbers to make [n m]/(n+m)=mean
04.09.2024
medium874. Walking Robot Simulation
Max distance after robot moves simulation
03.09.2024
easy1945. Sum of Digits of String After Convert
Sum of number chars k times
02.09.2024
medium1894. Find the Student that Will Replace the Chalk
Position of a k sum in a cyclic array
01.09.2024
easy2022. Convert 1D Array Into 2D Array
D to 2D mxn array
31.08.2024
medium1514. Path with Maximum Probability
Max path in graph
30.08.2024
hard2699. Modify Graph Edge Weights
Assign vacant -1 weight in graph to make shorted path equal target
29.08.2024
medium947. Most Stones Removed with Same Row or Column
Count islands of intersecting x and y
28.08.2024
medium1905. Count Sub Islands
Count islands intersecting in both 2D grids
27.08.2024
medium1514. Path with Maximum Probability
Max path in a weighted graph
26.08.2024
easy590. N-ary Tree Postorder Traversal
Postorder tree traversal
25.08.2024
easy145. Binary Tree Postorder Traversal
Postorder tree traversal tree
24.08.2024
hard564. Find the Closest Palindrome
Closest palindrome number
23.08.2024
easy592. Fraction Addition and Subtraction
Eval string of fractions sum
22.08.2024
easy476. Number Complement
Invert bits: 101 becomes 010 manipulation
21.08.2024
hard664. Strange Printer
Minimum continuous replacements to make a string programming
20.08.2024
medium1140. Stone Game II
Max Alice price taking 1..2m piles optimally with Bob programming
19.08.2024
medium650. 2 Keys Keyboard
Min copy-pastes to make n A's from one programming
18.08.2024
medium264. Ugly Number II
nth number with only [1,2,3,5] multipliers
17.08.2024
medium1937. Maximum Number of Points with Cost
Max top-down path sum with column diff in 2D matrix programming
16.08.2024
medium624. Maximum Distance in Arrays
Max diff between the arrays
15.08.2024
easy860. Lemonade Change
Simulate money exchange
14.08.2024
hard719. Find K-th Smallest Pair Distance
kth smallest pairs diff in an array search pointers
13.08.2024
medium40. Combination Sum II
Unique target sum subsequences
12.08.2024
easy703. Kth Largest Element in a Stream
kth largest in a stream of values
11.08.2024
hard1568. Minimum Number of Days to Disconnect Island
Min changes 1 to 0 to disconnect islands
10.08.2024
medium959. Regions Cut By Slashes
Count islands divided by '\' and '/' in 2D matrix
09.08.2024
medium840. Magic Squares In Grid
Count 9x9 1..9 equal row col diag sum subgrids
08.08.2024
medium885. Spiral Matrix III
D spiraling order
07.08.2024
hard273. Integer to English Words
Integer to English words
06.08.2024
medium3016. Minimum Number of Pushes to Type Word II
Minimum keystrokes after assigning letter to keys
05.08.2024
easy2053. Kth Distinct String in an Array
kth unique
04.08.2024
medium1508. Range Sum of Sorted Subarray Sums
Sum of [left..right] of sorted subarray's sums
03.08.2024
easy1460. Make Two Arrays Equal by Reversing Subarrays
Can arr transform to target by rotating subarrays?
02.08.2024
medium2134. Minimum Swaps to Group All 1's Together II
Min swaps to make a circular [01] array window
01.08.2024
easy2678. Number of Senior Citizens
Count filtered by a substring
31.07.2024
medium1105. Filling Bookcase Shelves
Min total height to split [[w,h]] array by shelfWidth programming
30.07.2024
medium1653. Minimum Deletions to Make String Balanced
Min removals to sort 'ab' string
29.07.2024
medium1395. Count Number of Teams
Count increasing or decreasing (i, j, k)
28.07.2024
hard2045. Second Minimum Time to Reach Destination
Second min time to travel from 1 to n in time-edged graph stopping every change seconds
27.07.2024
medium2976. Minimum Cost to Convert String I
Min cost to change the source to the target
26.07.2024
medium1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance
Node with minimum neighbors by distanceThreshold
25.07.2024
medium912. Sort an Array
Sort array using minimum memory
24.07.2024
medium2191. Sort the Jumbled Numbers
Sort array by digits mapping
23.07.2024
easy1636. Sort Array by Increasing Frequency
Sort by frequency or descending
22.07.2024
easy2418. Sort the People
Sort one array by another
21.07.2024
hard2392. Build a Matrix With Conditions
Build a matrix from a graph conditions
20.07.2024
medium1605. Find Valid Matrix Given Row and Column Sums
Matrix from rows and cols sums
19.07.2024
easy1380. Lucky Numbers in a Matrix
Min in rows and max in columns in a unique number matrix
18.07.2024
medium1530. Number of Good Leaf Nodes Pairs
Count at most distance paths between leaves
17.07.2024
medium1110. Delete Nodes And Return Forest
Trees after remove nodes from tree
16.07.2024
medium2096. Step-By-Step Directions From a Binary Tree Node to Another
U-L-R path from s to d in a Binary Tree
15.07.2024
medium2196. Create Binary Tree From Descriptions
Restore binary tree from [parent, child, isLeft]
14.07.2024
hard726. Number of Atoms
Simplify chemical formula parenthesis
13.07.2024
hard2751. Robot Collisions
D dimensional robots fight
12.07.2024
medium1717. Maximum Score From Removing Substrings
Max score removing from s, x for ab, y for ba
11.07.2024
medium1190. Reverse Substrings Between Each Pair of Parentheses
Reverse string in parentheses recursively
10.07.2024
easy1598. Crawler Log Folder
Filesystem path depth
9.07.2024
medium1701. Average Waiting Time
Average of intersecting intervals
8.07.2024
medium1823. Find the Winner of the Circular Game
Last of k-th excluded from 1..n
7.07.2024
easy1518. Water Bottles
Bottles drink and exchange simulation
6.07.2024
easy2582. Pass the Pillow
Loop position in increasing-decreasing array
5.07.2024
medium2058. Find the Minimum and Maximum Number of Nodes Between Critical Points
[min, max] distance between critical points in linked list list
4.07.2024
medium2181. Merge Nodes in Between Zeros
Collapse in-between 0 nodes in a LinkedList list
3.07.2024
medium1509. Minimum Difference Between Largest and Smallest Value in Three Moves
Min difference after 3 changes in array window programming
2.07.2024
easy350. Intersection of Two Arrays II
Array intersection with duplicates
1.07.2024
easy1550. Three Consecutive Odds
Has window of 3 odds?
30.06.2024
medium1579. Remove Max Number of Edges to Keep Graph Fully Traversable
Remove extra nodes in a connected graph by type 1, 2 and 3=1+2
29.06.2024
medium2192. All Ancestors of a Node in a Directed Acyclic Graph
List of ancestors in a DAG
28.06.2024
medium2285. Maximum Total Importance of Roads
Sort graph by siblings and compute sum(i s)
27.06.2024
easy1791. Find Center of Star Graph
Center of a start graph
26.06.2024
medium1382. Balance a Binary Search Tree
Make a balanced Binary Search Tree
25.06.2024
medium1038. Binary Search Tree to Greater Sum Tree
Aggregate Binary Search Tree from the right
24.06.2024
medium995. Minimum Number of K Consecutive Bit Flips
Count k-range flips in binary array to make all 1 window
23.06.2024
medium1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
Longest subarray with abs(a[i] - a[j]) <= limit window queue
22.06.2024
medium1248. Count Number of Nice Subarrays
Count subarrays with k odds window
21.06.2024
medium1052. Grumpy Bookstore Owner
Max customers sum after make consecutive minutes non-grumpy window
20.06.2024
medium1552. Magnetic Force Between Two Balls
Max shortest distance between m positions search
19.06.2024
medium1482. Minimum Number of Days to Make m Bouquets
Min days to take m k-subarrays search
18.06.2024
medium826. Most Profit Assigning Work
Max profit by assigning [profit, difficulty] to workers any times
17.06.2024
medium633. Sum of Square Numbers
Is c sum of squares? search
16.06.2024
hard330. Patching Array
Insertions to make subsets sums fill 1..n
15.06.2024
hard502. IPO
Max capital by choosing k jobs with profits[] & capital[] given w on start
14.06.2024
medium945. Minimum Increment to Make Array Unique
Min increments to make items unique
13.06.2024
easy2037. Minimum Number of Moves to Seat Everyone
Sum of diffs of sorted students and seats
12.06.2024
medium75. Sort Colors
Sort 012 array
11.06.2024
easy1122. Relative Sort Array
Sort an array by the given order
10.06.2024
easy1051. Height Checker
Count unsorted elements in array
09.06.2024
medium974. Subarray Sums Divisible by K
Count subarrays divisible by k
08.06.2024
medium523. Continuous Subarray Sum
Any subarray sum % k = 0
07.06.2024
medium648. Replace Words
Replace words with suffixes from dictionary
06.06.2024
medium846. Hand of Straights
Can array be split into consecutive groups
05.06.2024
easy1002. Find Common Characters
Common letters in words
04.06.2024
easy409. Longest Palindrome
Max palindrome length from chars
03.06.2024
medium2486. Append Characters to String to Make Subsequence
Min diff to make t substring of s
02.06.2024
easy344. Reverse String
Reverse an array
01.06.2024
easy3110. Score of a String
Sum(abs(window))
31.05.2024
medium260. Single Number III
Two not duplicated numbers from array manipulation
30.05.2024
medium1442. Count Triplets That Can Form Two Arrays of Equal XOR
Number (i,j,k) where xor arr[i..j] = xor arr[j..k] manipulation
29.05.2024
medium1404. Number of Steps to Reduce a Number in Binary Representation to One
Steps even/2, odd+1 to make binary s to 1
28.05.2024
medium1208. Get Equal Substrings Within Budget
Max substring sum(abs(s[..] - t[..])) < maxCost window
27.05.2024
easy1608. Special Array With X Elements Greater Than or Equal X
Count of more or equal nums[i] equal itself
26.05.2024
hard552. Student Attendance Record II
N times: A -> LP, L -> AP, P -> AL, at most one A, no LLL programming
25.05.2024
hard140. Word Break II
All string splits with dictionary programming
24.05.2024
hard1255. Maximum Score Words Formed by Letters
Max score of words subset from letters
23.05.2024
medium2597. The Number of Beautiful Subsets
Count subsets without k difference in them
22.05.2024
medium131. Palindrome Partitioning
All palindrome partitions programming
21.05.2024
medium78. Subsets
All subsets
20.05.2024
easy1863. Sum of All Subset XOR Totals
Sum of subsets xors
19.05.2024
hard3068. Find the Maximum Sum of Node Values
Max sum after xor k any edges in a tree
18.05.2024
medium979. Distribute Coins in Binary Tree
Min moves to spread the coins across the tree
17.05.2024
easy1325. Delete Leaves With a Given Value
Recursively remove target leafs from the tree
16.05.2024
easy2331. Evaluate Boolean Binary Tree
Evaluate tree where 0/1 is false/true and 2/3 is or/and
15.05.2024
medium2812. Find the Safest Path in a Grid
Safest path in a grid with thieves
14.05.2024
medium1219. Path with Maximum Gold
Max one-way path in matrix
13.05.2024
medium861. Score After Flipping Matrix
Max binary-row sum after toggling rows and columns
12.05.2024
easy2373. Largest Local Values in a Matrix
Max pooling by 3x3 matrix
11.05.2024
hard857. Minimum Cost to Hire K Workers
Min cost of k workers each doing quality[i] work for fair rate
10.05.2024
medium786. K-th Smallest Prime Fraction
kth arr[i]/arr[j], i < j, arr[i] < arr[j] search
09.05.2024
medium3075. Maximize Happiness of Selected Children
Sum of k maximums decreasing each step
08.05.2024
easy506. Relative Ranks
Convert results array to ranks array
07.05.2024
medium2816. Double a Number Represented as a Linked List
Double the number as a Linked List list
06.05.2024
medium2487. Remove Nodes From Linked List
Make a Linked List non-increasing list
05.05.2024
medium237. Delete Node in a Linked List
Delete current node in a Linked List
04.05.2024
medium881. Boats to Save People
Minimum total boats with at most 2 people & limit weight pointers
03.05.2024
medium165. Compare Version Numbers
Compare version numbers
02.05.2024
easy2441. Largest Positive Integer That Exists With Its Negative
Max number that has its negative in array pointers
01.05.2024
easy2000. Reverse Prefix of Word
Reverse [..ch] prefix in string
30.04.2024
medium1915. Number of Wonderful Substrings
Count substrings with at most one odd frequency manipulation
29.04.2024
medium2997. Minimum Number of Operations to Make Array XOR Equal to K
Bit diff between k and nums xor manipulation
28.04.2024
hard834. Sum of Distances in Tree
Sums of paths to each leafs in a tree
27.04.2024
hard514. Freedom Trail
Min steps to produce key by rotating ring programming map
26.04.2024
hard1289. Minimum Falling Path Sum II
Min non-direct path top down in a 2D matrix programming
25.04.2024
medium2370. Longest Ideal Subsequence
Max length of less than k adjacent subsequence programming
24.04.2024
easy1137. N-th Tribonacci Number
nth Tribonacci number f(n + 3) = f(n) + f(n + 1) + f(n + 2)
23.04.2024
medium310. Minimum Height Trees
Center of an acyclic graph
22.04.2024
medium752. Open the Lock
Steps to rotate 4-wheel 0000 -> target
21.04.2024
easy1971. Find if Path Exists in Graph
Are source and destination connected in graph?
20.04.2024
medium1992. Find All Groups of Farmland
Count 1-rectangles in 0-1 2D matrix
19.04.2024
medium200. Number of Islands
Count 1-islands in 0-1 a 2D matrix
18.04.2024
easy463. Island Perimeter
Perimeter of 1's islands in 01-matrix
17.04.2024
medium988. Smallest String Starting From Leaf
Smallest string from leaf to root in a Binary Tree
16.04.2024
medium623. Add One Row to Tree
Insert nodes at the depth of the Binary Tree
15.04.2024
medium129. Sum Root to Leaf Numbers
Sum root-leaf numbers in a Binary Tree
14.04.2024
easy404. Sum of Left Leaves
Left-leaf sum in a Binary Tree
13.04.2024
hard85. Maximal Rectangle
Max 1-only area in a 0-1 matrix
12.04.2024
hard42. Trapping Rain Water
Trap the water in area between vertical walls
11.04.2024
medium402. Remove K Digits
Minimum number after removing k digits
10.04.2024
medium950. Reveal Cards In Increasing Order
Sort cards by rules: take top, next goes bottom
09.04.2024
easy2073. Time Needed to Buy Tickets
Seconds to buy tickets by k-th person in a rotating 1 second queue
08.04.2024
easy1700. Number of Students Unable to Eat Lunch
First sandwitch not eaten by any while popped from a queue
07.04.2024
medium678. Valid Parenthesis String
Are parenthesis valid with wildcard?
06.04.2024
medium1249. Minimum Remove to Make Valid Parentheses
Remove minimum to make parenthesis valid
05.04.2024
easy1544. Make The String Great
Remove lowercase-uppercase pairs
04.04.2024
easy1614. Maximum Nesting Depth of the Parentheses
Max nested parenthesis
03.04.2024
medium79. Word Search
Does grid have a word path?
02.04.2024
easy205. Isomorphic Strings
Can map chars from one string to another?
01.04.2024
easy58. Length of Last Word
Last word length
31.03.2024
hard2444. Count Subarrays With Fixed Bounds
Count subarrays of range minK..maxK
30.03.2024
hard992. Subarrays with K Different Integers
Count subarrays with k distinct numbers
29.03.2024
medium2962. Count Subarrays Where Max Element Appears at Least K Times
Count subarrays with at least k array max in
28.03.2024
medium2958. Length of Longest Subarray With at Most K Frequency
Max subarray length with frequencies <= k
27.03.2024
medium713. Subarray Product Less Than K
Subarrays count with product less than k
26.03.2024
hard41. First Missing Positive
First number 1.. not presented in the array, O(1) space
25.03.2024
medium442. Find All Duplicates in an Array
All duplicate numbers of 1..n using O(1) memory
24.03.2024
medium287. Find the Duplicate Number
Duplicate single number in 1..n array, no extra memory
23.03.2024
medium143. Reorder List
Reorder Linked List 1->2->3->4->5 -> 1->5->2->4->3
22.03.2024
easy234. Palindrome Linked List
Is Linked List a palindrome
21.03.2024
easy206. Reverse Linked List
Reverse a Linked List
20.03.2024
medium1669. Merge In Between Linked Lists
Replace a segment in a LinkedList
19.03.2024
medium621. Task Scheduler
Count CPU cycles if task can't run twice in n cycles
18.03.2024
medium452. Minimum Number of Arrows to Burst Balloons
Count non-intersecting intervals
17.03.2024
medium57. Insert Interval
Insert interval into a sorted intervals array
16.03.2024
medium525. Contiguous Array
Max length of subarray sum(0) == sum(1)
15.03.2024
medium238. Product of Array Except Self
Array of suffix-prefix products
14.03.2024
medium930. Binary Subarrays With Sum
Count goal-sum subarrays in a 0-1 array
13.03.2024
easy2485. Find the Pivot Integer
Pivot of 1..n where sum[1..p] == sum[p..n].
12.03.2024
medium1171. Remove Zero Sum Consecutive Nodes from Linked List
Remove consequent 0-sum items from a LinkedList
11.03.2024
medium791. Custom Sort String
Construct string from s using order
10.03.2024
easy349. Intersection of Two Arrays
Intersection of two nums arrays
09.03.2024
easy2540. Minimum Common Value
First common number in two sorted arrays
08.03.2024
easy3005. Count Elements With Maximum Frequency
Count of max-freq nums
07.03.2024
easy876. Middle of the Linked List
Middle of the Linked List
06.03.2024
easy141. Linked List Cycle
Detect cycle
05.03.2024
medium1750. Minimum Length of String After Deleting Similar Ends
Min length after trimming matching prefix-suffix several times.
04.03.2024
medium948. Bag of Tokens
Max score converting power to token[i] and token[i] to score.
03.03.2024
medium19. Remove Nth Node From End of List
Remove nth node from the tail of linked list.
02.03.2024
easy977. Squares of a Sorted Array
Sorted squares.
01.03.2024
easy2864. Maximum Odd Binary Number
Max odd number string rearrangement.
29.02.2024
medium1609. Even Odd Tree
Binary tree levels are odd increasing and even decreasing.
28.02.2024
medium513. Find Bottom Left Tree Value
Leftmost node value of the last level of the Binary Tree.
27.02.2024
easy543. Diameter of Binary Tree
Max distance between any nodes in binary tree.
26.02.2024
easy100. Same Tree
Are two binary trees equal?
25.02.2024
hard2709. Greatest Common Divisor Traversal
Are all numbers connected through gcd?
24.02.2024
hard2092. Find All People With Secret
Who knows 0 and firstPerson's secret after group meetings at times: [personA, personB, time].
23.02.2024
medium787. Cheapest Flights Within K Stops
Cheapest travel src -> dst with at most k stops in a directed weighted graph.
22.02.2024
easy997. Find the Town Judge
Find who trusts nobody and everybody trusts him in [trust, trusted] array.
21.02.2024
medium201. Bitwise AND of Numbers Range
Bitwise AND for [left..right].
20.02.2024
easy268. Missing Number
Missing in [0..n] number.
19.02.2024
easy231. Power of Two
Is number 2^x?
18.02.2024
hard2402. Meeting Rooms III
Most frequent room of 0..
17.02.2024
medium1642. Furthest Building You Can Reach
Max index to climb diff = a[i +1] - a[i] > 0 using bricks -= diff and ladders-- for each.
16.02.2024
medium1481. Least Number of Unique Integers after K Removals
Min uniq count after removing k numbers.
15.02.2024
medium2971. Find Polygon With the Largest Perimeter
The largest subset sum(a[..i]) > a[i + 1] where a is a subset of array.
14.02.2024
medium2149. Rearrange Array Elements by Sign
Rearrange array to positive-negative sequence.
13.02.2024
easy2108. Find First Palindromic String in the Array
Find a palindrome.
12.02.2024
easy169. Majority Element
Element with frequency > nums.len / 2.
11.02.2024
medium1463. Cherry Pickup II
Maximum paths sum of two robots top-down in XY grid.
10.02.2024
medium647. Palindromic Substrings
Count palindromes substrings.
09.02.2024
medium368. Largest Divisible Subset
Longest subset of divisible by s[i] % s[j] == 0 || s[j] % s[i] == 0.
08.02.2024
medium279. Perfect Squares
Min square numbers sum up to n.
07.02.2024
medium451. Sort Characters By Frequency
Sort string by char's frequencies.
06.02.2024
medium49. Group Anagrams
Group words by chars in them.
05.02.2024
easy387. First Unique Character in a String
First non-repeating char position.
04.02.2024
hard76. Minimum Window Substring
Let's try to shorten the code
03.02.2024
medium1043. Partition Array for Maximum Sum
Max sum of partition array into chunks size of at most k filled with max value in chunk.
02.02.2024
medium1291. Sequential Digits
Numbers with sequential digits in low..high range.
01.02.2024
medium2966. Divide Array Into Arrays With Max Difference
Split array into tripples with at most k difference.
31.01.2024
medium739. Daily Temperatures
Array of distances to the next largest.
30.01.2024
medium150. Evaluate Reverse Polish Notation
Solve Reverse Polish Notation.
29.01.2024
easy232. Implement Queue using Stacks
Queue by 2 stacks.
28.01.2024
hard1074. Number of Submatrices That Sum to Target
Count submatrix target sums.
27.01.2024
hard629. K Inverse Pairs Array
Number of arrays of 1..n with k reversed order pairs.
26.01.2024
medium576. Out of Boundary Paths
Number of paths from cell in grid to out of boundary.
25.01.2024
medium1143. Longest Common Subsequence
Longest common subsequence of two strings.
24.01.2024
medium1457. Pseudo-Palindromic Paths in a Binary Tree
Count can-form-a-palindrome paths root-leaf in a binary tree.
23.01.2024
medium1239. Maximum Length of a Concatenated String with Unique Characters
Max length subsequence of strings array with unique chars.
22.01.2024
easy645. Set Mismatch
Return missing and duplicated number in 1..n array with one number replaced.
21.01.2024
medium198. House Robber
Max sum to rob non adjacent items in array.
20.01.2024
medium907. Sum of Subarray Minimums
Sum of minimums of all array ranges.
19.01.2024
medium931. Minimum Falling Path Sum
Min sum moving bottom center, left, right in 2D matrix.
18.01.2024
easy70. Climbing Stairs
Ways to climb n stairs by 1 or 2 steps.
17.01.2024
easy1207. Unique Number of Occurrences
Are array frequencies unique.
16.01.2024
medium380. Insert Delete GetRandom O(1)
Implement HashSet
15.01.2024
medium2225. Find Players With Zero or One Losses
[sorted winners list, sorted single lose list]
14.01.2024
medium1657. Determine if Two Strings Are Close
Are strings convertible by swapping existing chars positions or frequencies.
13.01.2024
medium1347. Minimum Number of Steps to Make Two Strings Anagram
Min operations to make string t anagram of s.
12.01.2024
easy1704. Determine if String Halves Are Alike
Let's use some Kotlin's API
11.01.2024
medium1026. Maximum Difference Between Node and Ancestor
Max diff between node and ancestor in a binary tree.
10.01.2024
medium2385. Amount of Time for Binary Tree to Be Infected
Max distance from node in a Binary Tree.
9.01.2024
easy872. Leaf-Similar Trees
Are leafs sequences equal for two trees.
8.01.2024
easy938. Range Sum of BST
Sum of BST in range [low..high].
7.01.2024
hard446. Arithmetic Slices II - Subsequence
Count of arithmetic subsequences.
6.01.2024
hard1235. Maximum Profit in Job Scheduling
Max profit in non-intersecting jobs given startTime[], endTime[] and profit[].
5.01.2024
medium300. Longest Increasing Subsequence
Longest increasing subsequence length.
4.01.2024
medium2870. Minimum Number of Operations to Make Array Empty
Minimum pairs or triples duplicate removal operations to empty array of numbers.
3.01.2024
medium2125. Number of Laser Beams in a Bank
Beams count between consequent non-empty row's 1s.
2.01.2024
medium2610. Convert an Array Into a 2D Array With Conditions
Convert numbers array into array of unique number-rows.
1.01.2024
easy455. Assign Cookies
Max count of greedy children g[Int] to assign cookies with sizes s[Int].
31.12.2023
easy1624. Largest Substring Between Two Equal Characters
Max distance between same chars in string.
30.12.2023
easy1897. Redistribute Characters to Make All Strings Equal
Is it possible to split all the words[] characters into words.size groups.
29.12.2023
hard1335. Minimum Difficulty of a Job Schedule
Min sum of maximums jobDifficulty[i] per day d preserving the order
28.12.2023
hard1531. String Compression II
Min length of run-length encoded aabcc -> a2bc3 after deleting at most k characters
27.12.2023
medium1578. Minimum Time to Make Rope Colorful
Min sum of removed duplicates in array.
26.12.2023
medium1155. Number of Dice Rolls With Target Sum
Ways to throw once n dices with k faces to make target sum.
25.12.2023
medium91. Decode Ways
Ways to decode back 'A' -> '1', 'B' -> '2' … 'Z' -> '26'
24.12.2023
easy1758. Minimum Changes To Make Alternating Binary String
In a stressfull situation better to just use 4 counters: oddOnes, evenOnes, oddZeros, evenZeros. Then do something with them.
23.12.2023
easy1496. Path Crossing
Is path string of 'N', 'E', 'W', 'S' crosses
22.12.2023
easy1422. Maximum Score After Splitting a String
Max left zeros + right ones in 01-array
21.12.2023
easy1637. Widest Vertical Area Between Two Points Containing No Points
Max x window between xy points
20.12.2023
easy2706. Buy Two Chocolates
Money change after two chocolates bought
19.12.2023
easy661. Image Smoother
x3 average of each cell in 2D matrix
18.12.2023
easy1913. Maximum Product Difference Between Two Pairs
max second max - min second min
17.12.2023
medium2353. Design a Food Rating System
Given foods, cuisines and ratings implement efficient methods changeRating(food, newRating) and highestRated(cuisine)
16.12.2023
easy242. Valid Anagram
#### Join me on Telegram
15.12.2023
easy1436. Destination City
#### Join me on Telegram
14.12.2023
easy2482. Difference Between Ones and Zeros in Row and Column
diff[i][j] = onesRowi + onesColj - zerosRowi - zerosColj
13.12.2023
easy1582. Special Positions in a Binary Matrix
#### Join me on Telegram
12.12.2023
easy1464. Maximum Product of Two Elements in an Array
#### Join me on Telegram
11.12.2023
easy1287. Element Appearing More Than 25% In Sorted Array
Most frequent element
10.12.2023
easy867. Transpose Matrix
Transpose 2D matrix
09.12.2023
easy94. Binary Tree Inorder Traversal
Inorder traversal
08.12.2023
easy606. Construct String from Binary Tree
Pre-order binary tree serialization
07.12.2023
easy1903. Largest Odd Number in String
Largest odd number in a string
05.12.2023
easy1688. Count of Matches in Tournament
Count of odd-even matches according to the rules x/2 or 1+(x-1)/2.
04.12.2023
easy2264. Largest 3-Same-Digit Number in String
Largest 3-same-digit number in a string
03.12.2023
easy1266. Minimum Time Visiting All Points
Path coordinates distance in XY plane
02.12.2023
easy1160. Find Words That Can Be Formed by Characters
Sum of words lengths constructed by chairs
01.12.2023
easy1662. Check If Two String Arrays are Equivalent
Two dimensional array equals
30.11.2023
hard1611. Minimum One Bit Operations to Make Integers Zero
Minimum rounds of inverting rightmost bit or left of the rightmost 1 bit to make n zero
29.11.2023
easy191. Number of 1 Bits
Bits count
28.11.2023
hard2147. Number of Ways to Divide a Long Corridor
Count ways to place borders separating pairs of 'S' in 'SP' string
27.11.2023
medium935. Knight Dialer
Count of dialer n-length numbers formed by pressing in a chess Knight's moves
26.11.2023
medium1727. Largest Submatrix With Rearrangements
Max area of 1 submatrix after sorting columns optimally
25.11.2023
medium1685. Sum of Absolute Differences in a Sorted Array
Array to sum j(abs(arr[i] - arr[j])) for each i
24.11.2023
medium1561. Maximum Number of Coins You Can Get
Get sum of second maxes of triples from array
23.11.2023
medium1630. Arithmetic Subarrays
Query array ranges can form arithmetic sequence
22.11.2023
medium1424. Diagonal Traverse II
Diagonal 2D matrix order with prunes
21.11.2023
medium1814. Count Nice Pairs in an Array
Count pairs x-rev(x) == y-rev(y), where rev(123) = 321
20.11.2023
medium2391. Minimum Amount of Time to Collect Garbage
Time to pick 3-typed garbage[] by 3 trucks traveling to the right travel[] time
19.11.2023
medium1887. Reduction Operations to Make the Array Elements Equal
Number of operations to decrease all elements to the next smallest
18.11.2023
medium1838. Frequency of the Most Frequent Element
Max count of equal numbers if increment arr[i] k times
17.11.2023
medium1877. Minimize Maximum Pair Sum in Array
Minimum possible max of array pairs sums
16.11.2023
medium1980. Find Unique Binary String
First absent number in a binary string array
15.11.2023
medium1846. Maximum Element After Decreasing and Rearranging
Max number from converting array to non decreasing
14.11.2023
medium1930. Unique Length-3 Palindromic Subsequences
Count of unique palindrome substrings of length 3
13.11.2023
medium2785. Sort Vowels in a String
Sort vowels in a string
12.11.2023
hard815. Bus Routes
Minimum buses to travel by given routes
11.11.2023
hard2642. Design Graph With Shortest Path Calculator
Implement graph with shortest path searching
10.11.2023
medium1743. Restore the Array From Adjacent Pairs
Restore an array from adjacent pairs
09.11.2023
medium1759. Count Number of Homogenous Substrings
Count of substrings of same chars
08.11.2023
medium2849. Determine if a Cell Is Reachable at a Given Time
Is path possible on grid sx, sy -> fx, fy
07.11.2023
medium1921. Eliminate Maximum Number of Monsters
Count possible 1-minute kills in a game of dist[] targets falling with speed[]
06.11.2023
medium1845. Seat Reservation Manager
Design reservation number system
05.11.2023
medium1535. Find the Winner of an Array Game
Find maximum of the k nearest in array
04.11.2023
medium1503. Last Moment Before All Ants Fall Out of a Plank
Max time ants on a line when goint left and right
03.11.2023
medium767. Reorganize String
Non-repeating consequent chars string from another string
02.11.2023
medium2265. Count Nodes Equal to Average of Subtree
Number of nodes in a tree where val == sum / count of a subtree
01.11.2023
easy501. Find Mode in Binary Search Tree
Most frequent elements in a Binary Search Tree
31.10.2023
medium2433. Find The Original Array of Prefix Xor
Reverse xor operation
30.10.2023
easy1356. Sort Integers by The Number of 1 Bits
Sort an array comparing by bit count and value
29.10.2023
hard458. Poor Pigs
Minimum pigs to find a poison in buckets in k rounds
28.10.2023
hard1220. Count Vowels Permutation
Count of n lengths paths according to graph rules a->e, e->(a, i), etc
27.10.2023
medium5. Longest Palindromic Substring
Longest palindrome substring
26.10.2023
medium823. Binary Trees With Factors
Number of trees from arr where each k node has i and j leafs arr[k]=arr[j] arr[i]
25.10.2023
medium779. K-th Symbol in Grammar
Binary Tree 0 -> 01, 1 -> 10 at [n][k] position
24.10.2023
medium515. Find Largest Value in Each Tree Row
Binary Tree's maxes of the levels
23.10.2023
easy342. Power of Four
Is n == x^4?
22.10.2023
hard1793. Maximum Score of a Good Subarray
Max of window min (window size) for window having nums[k]
21.10.2023
hard1425. Constrained Subsequence Sum
Max sum of subsequence i - j <= k
20.10.2023
medium341. Flatten Nested List Iterator
Implement graph iterator
19.10.2023
medium844. Backspace String Compare
Remove all of the backspaced chars before comparing
18.10.2023
hard2050. Parallel Courses III
Shortest time to visit all nodes in relations=[from, to] graph
17.10.2023
medium1361. Validate Binary Tree Nodes
Is Binary Tree of leftChild[] & rightChild[] valid
16.10.2023
easy119. Pascal's Triangle II
Pascal's Triangle
15.10.2023
hard1269. Number of Ways to Stay in the Same Place After Some Steps
Number of ways to return to 0 after moving left, right or stay steps time
14.10.2023
hard2742. Painting the Walls
Min cost to complete all tasks using one paid cost[] & time[] and one free 0 & 1 workers
13.10.2023
easy746. Min Cost Climbing Stairs
Classic DP: climbing stairs
12.10.2023
hard1095. Find in Mountain Array
Binary Search in a mountain
11.10.2023
hard2251. Number of Flowers in Full Bloom
Array of counts of segments in intersection
10.10.2023
hard2009. Minimum Number of Operations to Make Array Continuous
Min replacements to make array continuous a[i] = a[i - 1] + 1
9.10.2023
medium34. Find First and Last Position of Element in Sorted Array
Binary Search range
8.10.2023
hard1458. Max Dot Product of Two Subsequences
Max product of two subsequences
7.10.2023
hard1420. Build Array Where You Can Find The Maximum Exactly K Comparisons
Count possible arrays of n 1..m values increasing k times
6.10.2023
medium343. Integer Break
Max multiplication of the number split
5.10.2023
medium229. Majority Element II
Elements with frequency > size / 3
4.10.2023
easy706. Design HashMap
Design a HashMap
3.10.2023
easy1512. Number of Good Pairs
Count equal pairs
2.10.2023
medium2038. Remove Colored Pieces if Both Neighbors are the Same Color
Is A wins in middle-removing AAA or BBB game
1.10.2023
easy557. Reverse Words in a String III
Reverse words
30.09.2023
medium456. 132 Pattern
132 pattern in array
29.09.2023
easy896. Monotonic Array
Is array monotonic
28.09.2023
easy905. Sort Array By Parity
Sort an array by even-odd
27.09.2023
medium880. Decoded String at Index
k-th character in an encoded string like a3b2=aaabaaab
26.09.2023
medium316. Remove Duplicate Letters
Lexicographical smallest subsequence without duplicates
25.09.2023
easy389. Find the Difference
Strings difference by a single char
24.09.2023
medium799. Champagne Tower
Positional flow value in a Pascal's Triangle
23.09.2023
medium1048. Longest String Chain
Longest chain of words with single character added
22.09.2023
easy392. Is Subsequence
Is string a subsequence of another
21.09.2023
hard4. Median of Two Sorted Arrays
Median in two concatenated sorted arrays
20.09.2023
medium1658. Minimum Operations to Reduce X to Zero
Min suffix-prefix to make an x
19.09.2023
medium287. Find the Duplicate Number
Found duplicate in array, each value is in 1..
18.09.2023
easy1337. The K Weakest Rows in a Matrix
k indices with smallest row sum in a binary matrix
16.09.2023
medium1631. Path With Minimum Effort
Minimum absolute difference in path top-left to right-bottom
15.09.2023
medium1584. Min Cost to Connect All Points
Min manhatten distance connected graph
14.09.2023
hard332. Reconstruct Itinerary
Smallest lexical order path using all the tickets
13.09.2023
hard135. Candy
Minimum candies count to satisfy condition: ratings[i] < ratings[i-1] must give more candies to i-1
12.09.2023
medium1647. Minimum Deletions to Make Character Frequencies Unique
Minimum removes duplicate frequency chars from string
11.09.2023
medium1282. Group the People Given the Group Size They Belong To
Groups from groups sizes array
10.09.2023
hard1359. Count All Valid Pickup and Delivery Options
Count permutations of the n pickup -> delivery orders
9.09.2023
medium377. Combination Sum IV
Number of ways to sum up array nums to target
8.09.2023
easy118. Pascal's Triangle
Pascal Triangle
7.09.2023
medium92. Reverse Linked List II
Reverse a part of Linked List
6.09.2023
medium725. Split Linked List in Parts
Split Linked List into k almost equal lists
5.09.2023
medium138. Copy List with Random Pointer
Copy of a graph
4.09.2023
easy141. Linked List Cycle
Detect a cycle in a LinkedList
3.09.2023
medium62. Unique Paths
Unique paths count, moving right-down from top-left to bottom-right
2.09.2023
medium2707. Extra Characters in a String
Min count of leftovers after string split by the dictionary
1.09.2023
easy338. Counting Bits
Array of bits count for numbers 0..n
31.08.2023
hard1326. Minimum Number of Taps to Open to Water a Garden
Fill all space between 0..n using minimum intervals
30.08.2023
hard2366. Minimum Replacements to Sort the Array
Minimum number of number splits to make an array non-decreasing
29.08.2023
medium2483. Minimum Penalty for a Shop
First index of minimum penalty in array, penalty 'Y'-> 1, 'N' -> -1
28.08.2023
easy225. Implement Stack using Queues
Create a Stack using Queue's push/pop methods.
27.08.2023
hard403. Frog Jump
Can jump an array when each jump is k-1..k+1 of the previous
26.08.2023
medium646. Maximum Length of Pair Chain
Max count non-overlaping intervals
25.08.2023
medium97. Interleaving String
Can a string be a merge of two other strings
24.08.2023
hard68. Text Justification
Spread words to lines, evenly spacing left->right, and left-spacing the last line
23.08.2023
medium767. Reorganize String
Create non repeated subsequent chars string from string
22.08.2023
easy168. Excel Sheet Column Title
Excel col number to letter-number 1 -> A, 28 -> AB
21.08.2023
easy459. Repeated Substring Pattern
careful to not shift by whole length
20.08.2023
hard1203. Sort Items by Groups Respecting Dependencies
Sort items by groups and in groups given dependencies.
19.08.2023
hard1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
List of list of must-have edges and list of optional edges for Minimum Weight Minimum Spanning Tree
18.08.2023
medium1615. Maximal Network Rank
Max edges count for each pair of nodes
17.08.2023
medium542. 01 Matrix
Distances to 0 in an 0-1 matrix
16.08.2023
medium239. Sliding Window Maximum
List of sliding window's maximums
15.08.2023
medium86. Partition List
Partition a Linked List by x value
14.08.2023
medium215. Kth Largest Element in an Array
Kth largest in an array
13.08.2023
medium2369. Check if There is a Valid Partition For The Array
Is it possible to partition an array of 2 or 3 equal nums or 3 increasing nums.
12.08.2023
medium63. Unique Paths II
Number of right-down ways tl->br in a matrix with obstacles
11.08.2023
medium518. Coin Change II
Ways to make amount with array of coins
10.08.2023
medium81. Search in Rotated Sorted Array II
Binary Search in a rotated array with duplicates
09.08.2023
medium2616. Minimize the Maximum Difference of Pairs
Minimum of maximums possible p diffs of distinct array positions
08.08.2023
medium33. Search in Rotated Sorted Array
Binary Search in a shifted array
07.08.2023
medium74. Search a 2D Matrix
D Binary Search
06.08.2023
hard920. Number of Music Playlists
Playlists number playing n songs goal times, repeating each once in a k times
05.08.2023
medium95. Unique Binary Search Trees II
All possible Binary Search Trees for 1..n numbers
04.08.2023
medium139. Word Break
If a word is a wordDict concatenation
03.08.2023
medium17. Letter Combinations of a Phone Number
Possible words from phone keyboard
02.08.2023
medium46. Permutations
List of all numbers permutations
01.08.2023
medium77. Combinations
All combinations choosing k numbers from 1..n numbers
31.07.2023
medium712. Minimum ASCII Delete Sum for Two Strings
Minimum removed chars sum to make strings equal
30.07.2023
hard664. Strange Printer
Minimum continuous overrides by the same character to make a string
29.07.2023
medium808. Soup Servings
Probability of soup A drained first or both A and B with 0.5 multiplier.
28.07.2023
medium486. Predict the Winner
Optimally taking numbers from an array's ends can one player win another
27.07.2023
hard2141. Maximum Running Time of N Computers
Maximum time to use n batteries in parallel
26.07.2023
medium1870. Minimum Speed to Arrive on Time
Max speed for all dist departing at round hours, be fit in hour
25.07.2023
medium852. Peak Index in a Mountain Array
Mountain pattern index in the array in log time
24.07.2023
medium50. Pow(x, n)
x^n
23.07.2023
medium894. All Possible Full Binary Trees
All possible Full Binary Trees with n nodes, each have both children
22.07.2023
medium688. Knight Probability in Chessboard
Probability of making k steps on a chessboard without stepping outside
21.07.2023
medium673. Number of Longest Increasing Subsequence
use an array cache, as Map gives TLE
20.07.2023
medium735. Asteroid Collision
Result after asteroids collide left-right exploding by size: 15 5 -15 -5 5 -> -15 -5 5
19.07.2023
medium435. Non-overlapping Intervals
Minimum intervals to erase overlap
18.07.2023
medium146. LRU Cache
use firstNode and lastNode
17.07.2023
medium445. Add Two Numbers II
Linked List of sum of two Linked Lists numbers, 9->9 + 1 = 1->0->0
16.07.2023
hard1125. Smallest Sufficient Team
Smallest team from people with skills, having all required skills
15.07.2023
hard1751. Maximum Number of Events That Can Be Attended II
Max sum of at most k values from non-intersecting array of (from, to, value) items
14.07.2023
medium1218. Longest Arithmetic Subsequence of Given Difference
Longest arithmetic difference subsequence
13.07.2023
medium207. Course Schedule
If none edges in a cycle
12.07.2023
medium802. Find Eventual Safe States
List of nodes not in cycles
12.07.2023
medium863. All Nodes Distance K in Binary Tree
List of k distanced from target nodes in a Binary Tree
11.07.2023
easy111. Minimum Depth of Binary Tree
Count nodes in the shortest path from root to leaf
10.07.2023
hard2272. Substring With Largest Variance
Max diff between count s[i] and count s[j] in all substrings of s
9.07.2023
hard2551. Put Marbles in Bags
abs(max - min), where max and min are the sum of k interval borders
7.07.2023
medium2024. Maximize the Confusion of an Exam
Max same letter subarray replacing k letters
6.07.2023
medium209. Minimum Size Subarray Sum
Min length subarray with sum >= target
5.07.2023
medium1493. Longest Subarray of 1's After Deleting One Element
Largest 1..1 subarray after removing one item
4.07.2023
medium137. Single Number II
Let's use fold.
3.07.2023
easy859. Buddy Strings
Is it just one swap s[i]<>s[j] to string s == string goal
2.07.2023
hard1601. Maximum Number of Achievable Transfer Requests
Max edges to make all counts in == out edges in graph
1.07.2023
medium2305. Fair Distribution of Cookies
Min of the max distributing n cookies to k children
30.06.2023
hard1970. Last Day Where You Can Still Cross
Last day matrix connected top-bottom when flooded each day at cells[day]
29.06.2023
hard864. Shortest Path to Get All Keys
Min steps to collect all lowercase keys in matrix. # and uppercase locks are blockers.
28.06.2023
medium1514. Path with Maximum Probability
Max probability path from start to end in a probability edges graph
27.06.2023
medium373. Find K Pairs with Smallest Sums
List of increasing sum pairs a[i], b[j] from two sorted lists a, b
26.06.2023
medium2462. Total Cost to Hire K Workers
The sum of the smallest cost from suffix and prefix of a costs size of candidates in k iterations
25.06.2023
hard1575. Count All Possible Routes
Count paths from start to finish using |locations[i]-locations[j] of the fuel
24.06.2023
hard956. Tallest Billboard
Max sum of disjoint set in array
23.06.2023
medium1027. Longest Arithmetic Subsequence
Max arithmetic subsequence length in array
22.06.2023
medium714. Best Time to Buy and Sell Stock with Transaction Fee
Max profit from buying stocks and selling them with fee for prices[day]
21.06.2023
hard2448. Minimum Cost to Make Array Equal
Min cost to make all arr[i] equal, where each change is cost[i]
20.06.2023
medium2090. K Radius Subarray Averages
Array containing sliding window of size 2k+1 average or -1
19.06.2023
easy1732. Find the Highest Altitude
Max running sum
18.06.2023
hard2328. Number of Increasing Paths in a Grid
Count increasing paths in a matrix
17.06.2023
hard1187. Make Array Strictly Increasing
Minimum replacements to make arr1 increasing using any numbers arr2
16.06.2023
hard1569. Number of Ways to Reorder Array to Get Same BST
Count permutations of an array with identical Binary Search Tree
15.06.2023
medium1161. Maximum Level Sum of a Binary Tree
Binary Tree level with max sum
14.06.2023
easy530. Minimum Absolute Difference in BST
Min difference in a BST
13.06.2023
medium2352. Equal Row and Column Pairs
Count of rowArray == colArray in an n x n matrix.
12.06.2023
easy228. Summary Ranges
Fold continues ranges in a sorted array 1 2 3 5 -> 1->3, 5
11.06.2023
medium1146. Snapshot Array
Implement an array where all elements can be saved into a `snapshot's.
10.06.2023
medium1802. Maximum Value at a Given Index in a Bounded Array
Max at index in an n sized array, where sum <= maxSum, nums[i] > 0 and maxDiff(i, i+1) < 2.
09.06.2023
easy744. Find Smallest Letter Greater Than Target
Lowest char greater than target.
08.06.2023
easy1351. Count Negative Numbers in a Sorted Matrix
Count negatives in a sorted by row and by column matrix.
07.06.2023
medium1318. Minimum Flips to Make a OR b Equal to c
Minimum a and b Int bit flips to make a or b == c.
06.06.2023
easy1502. Can Make Arithmetic Progression From Sequence
Is IntArray can be arithmetic progression?
05.06.2023
easy1232. Check If It Is a Straight Line
Are all the x,y points in a line?
04.06.2023
medium547. Number of Provinces
Count connected groups in graph.
03.06.2023
medium1376. Time Needed to Inform All Employees
Total time from headID to all nodes in graph.
02.06.2023
medium2101. Detonate the Maximum Bombs
Count detonated bombs by chain within each radius.
01.06.2023
medium1091. Shortest Path in Binary Matrix
0 path length in a binary square matrix.
31.05.2023
medium1396. Design Underground System
Average time from, to when different user IDs do checkIn(from, time1) and checkOut(to, time2)
30.05.2023
easy705. Design HashSet
Write a HashSet.
29.05.2023
easy1603. Design Parking System
Return if car of type 1, 2 or 3 can be added given sizes big, medium and small.
28.05.2023
hard1547. Minimum Cost to Cut a Stick
Min cost of cuts c1,..,ci,..,cn of [0..n] where cut cost the length = to-from.
27.05.2023
hard1406. Stone Game III
Winner of “Alice”, “Bob” or “Tie” in game of taking 1, 2 or 3 stones by turn from stoneValue array.
26.05.2023
medium1140. Stone Game II
While Alice and Bob optimally take 1..2 m numbers from piles find maximum for Alice.
25.05.2023
medium837. New 21 Game
Probability sum of random numbers 1..maxPts sum be < n after it overflow k.
24.05.2023
medium2542. Maximum Subsequence Score
Max score of k sum(subsequence(a)) min(subsequence(b))
23.05.2023
medium703. Kth Largest Element in a Stream
Kth largest
22.05.2023
medium347. Top K Frequent Elements
First k unique elements sorted by frequency.
21.05.2023
medium934. Shortest Bridge
Find the shortest path from one island of 1's to another.
20.05.2023
medium399. Evaluate Division
Given values for a/b and b/c find answers for a/c.
19.05.2023
medium785. Is Graph Bipartite?
Find if graph is bipartite
18.05.2023
medium1557. Minimum Number of Vertices to Reach All Nodes
Find all starting nodes in graph.
17.05.2023
medium2130. Maximum Twin Sum of a Linked List
Max sum of head-tail twin ListNodes: a-b-c-d -> max(a+d, b+c)
16.05.2023
medium24. Swap Nodes in Pairs
Swap adjacent ListNodes a-b-c-d -> b-a-d-c.
15.05.2023
medium1721. Swapping Nodes in a Linked List
Swap the values of the head-tail k'th ListNodes.
14.05.2023
hard1799. Maximize Score After N Operations
Max indexed-gcd-pair sum from 2n array; [3,4,6,8] -> 11 (1gcd(3,6) + 2gcd(4,8))
13.05.2023
medium2466. Count Ways To Build Good Strings
Let's write a DFS solution, adding zero or one and count the good strings.
12.05.2023
medium2140. Solving Questions With Brainpower
Let's implement a bottom-up solution.
11.05.2023
medium1035. Uncrossed Lines
use an array for the faster cache instead of HashMap
10.05.2023
medium59. Spiral Matrix II
to detect an empty cell, we can check it for == 0
9.05.2023
medium54. Spiral Matrix
do track the borders left, top, right, bottom
8.05.2023
easy1572. Matrix Diagonal Sum
avoid double counting of the center element
7.05.2023
hard1964. Find the Longest Valid Obstacle Course at Each Position
google what is the solution of LIS
6.05.2023
medium1498. Number of Subsequences That Satisfy the Given Sum Condition
Precompute the 2-powers
5.05.2023
medium1456. Maximum Number of Vowels in a Substring of Given Length
we can use Set to check if it is a vowel
4.05.2023
medium649. Dota2 Senate
Use Queue and count how many bans are from the Radiant and from the Dire.
3.05.2023
easy2215. Find the Difference of Two Arrays
One way is to use two Sets and just filter them.
2.05.2023
easy1822. Sign of the Product of an Array
There is an sign function in kotlin, but leetcode.com doesn't support it yet.
1.05.2023
easy1491. Average Salary Excluding the Minimum and Maximum Salary
We can do .fold and iterate only once, but sum, max and min operators are less verbose.
30.04.2023
hard1579. Remove Max Number of Edges to Keep Graph Fully Traversable
Use separate Union-Find objects for Alice and for Bob
29.04.2023
hard1697. Checking Existence of Edge Length Limited Paths
for better time complexity, compress the Union-Find path uf[x] = n
28.04.2023
hard839. Similar String Groups
decrease the groups when the two groups are joined together
27.04.2023
medium319. Bulb Switcher
Use found law and write the code.
26.04.2023
easy258. Add Digits
It is just an array pointer loop shifted by 1.
25.04.2023
medium2336. Smallest Number in Infinite Set
Let's implement a sparse array.
24.04.2023
easy1046. Last Stone Weight
use PriorityQueue with compareByDescending
23.04.2023
hard1416. Restore The Array
use Long to avoid overflow
22.04.2023
hard1312. Minimum Insertion Steps to Make a String Palindrome
Just DFS and cache.
21.04.2023
hard879. Profitable Schemes
Do DFS and cache result in an array.
20.04.2023
medium662. Maximum Width of Binary Tree
We can do BFS and track node positions.
19.04.2023
medium1372. Longest ZigZag Path in a Binary Tree
Compute the max as you go
18.04.2023
easy1768. Merge Strings Alternately
we can use sequence zip operator
17.04.2023
easy1431. Kids With the Greatest Number of Candies
Let's write the code
16.04.2023
hard1639. Number of Ways to Form a Target String Given a Dictionary
precompute the freq array - count of each character at each position
15.04.2023
hard2218. Maximum Value of K Coins From Piles
We can cache the result by the keys of every pile to taken
14.04.2023
medium516. Longest Palindromic Subsequence
For cleaner code
13.04.2023
medium946. Validate Stack Sequences
use one iteration and a second pointer for pop
12.04.2023
medium71. Simplify Path
split the string by /
11.04.2023
medium2390. Removing Stars From a String
we can use a Stack, or just StringBuilder
10.04.2023
medium20. Valid Parentheses
use HashMap to check matching bracket.
09.04.2023
hard1857. Largest Color Value in a Directed Graph
use visited set to detect cycles
08.04.2023
medium133. Clone Graph
we can avoid using visited set by checking if a new node already has filled its neighbors.
07.04.2023
medium1020. Number of Enclaves
We can use visited set, or modify the grid or use Union-Find.
06.04.2023
medium1254. Number of Closed Islands
DFS will solve the problem.
05.04.2023
medium2439. Minimize Maximum of Array
careful with integers overflows
04.04.2023
medium2405. Optimal Partition of String
use hashset, [26] array or simple 32-bit mask to store visited flags for character
03.04.2023
medium881. Boats to Save People
Sort an array and move two pointers lo and hi.
02.04.2023
medium2300. Successful Pairs of Spells and Potions
sort potions
01.04.2023
easy704. Binary Search
For more robust code
31.03.2023
hard1444. Number of Ways of Cutting a Pizza
carefully precompute prefix sum. You move by row, increasing sumX, then you move by column and reuse the result of the previous row.
30.03.2023
hard87. Scramble String
A simple approach is to concatenate strings, but in Kotlin it gives TLE, so we need bottom up approach, or just operate with indices.
29.03.2023
hard1402. Reducing Dishes
The naive $$O(n^2)$$ solution will work. However, there is an optimal one if we simply go from the end.
28.03.2023
medium983. Minimum Cost For Tickets
Let's write DFS with memoization algorithm as it is simple to understand.
27.03.2023
medium64. Minimum Path Sum
Use DFS + memo, careful with the ending condition.
26.03.2023
hard2360. Longest Cycle in a Graph
Use separate visited sets for the current path and for the global visited nodes.
25.03.2023
medium2316. Count Unreachable Pairs of Nodes in an Undirected Graph
use path compression for better root time complexity
24.03.2023
medium1466. Reorder Routes to Make All Paths Lead to the City Zero
We can use data structure or just use sign to encode the direction.
23.03.2023
medium1319. Number of Operations to Make Network Connected
for the better time complexity of the findRoot use path compression: uf[x] = n
22.03.2023
medium2492. Minimum Score of a Path Between Two Cities
Connect all roads and update minimums in the Union-Find data structure. Use simple arrays for both connections and minimums.
21.03.2023
medium2348. Number of Zero-Filled Subarrays
We can count subarray sums, then add them to the result, or we can just skip directly to adding to the result.
20.03.2023
easy605. Can Place Flowers
careful with corner cases
19.03.2023
medium211. Design Add and Search Words Data Structure
Let's try to write it in a Kotlin way, using as little words as possible.
18.03.2023
medium1472. Design Browser History
Just implement it.
17.03.2023
medium208. Implement Trie (Prefix Tree)
Let's try to write it Kotlin-way
16.03.2023
medium106. Construct Binary Tree from Inorder and Postorder Traversal
To more robust code, consider moving postTo variable as we go in the reverse-postorder: from the right to the left.
15.03.2023
medium958. Check Completeness of a Binary Tree
Right depth must not be larger than left.
14.03.2023
medium129. Sum Root to Leaf Numbers
The most trivial way is to keep sum variable outside the dfs function.
13.03.2023
easy101. Symmetric Tree
Recursive: just write helper function.
12.03.2023
hard23. Merge k Sorted Lists
use dummy head
11.03.2023
medium109. Convert Sorted List to Binary Search Tree
Compute the middle of the linked list.
10.03.2023
medium382. Linked List Random Node
Write the naive solution, then go to Wikipedia, and hope you will not get this in the interview.
09.03.2023
medium142. Linked List Cycle II
careful with corner cases.
08.03.2023
medium875. Koko Eating Bananas
For more robust binary search
07.03.2023
medium2187. Minimum Time to Complete Trips
Do a binary search. For the hi value, we can peak a $$10^7$$ or just compute all the time it takes for every bus to trip.
06.03.2023
easy1539. Kth Missing Positive Number
For more robust binary search code
05.03.2023
hard1345. Jump Game IV
This problem gives TLE until we do one trick
04.03.2023
hard2444. Count Subarrays With Fixed Bounds
For the explicit solution, we take each interval, store positions of the min and max in a TreeSet, then we must take poll those mins and maxes and consider each range separately
03.03.2023
medium28. Find the Index of the First Occurrence in a String
carefull with indexes
02.03.2023
medium443. String Compression
Let's just do a naive toString for simplicity.
01.03.2023
medium912. Sort an Array
Let's just implement naive quicksort.
28.02.2023
medium652. Find Duplicate Subtrees
Let's use pre-order traversal and serialize each node into string, also add that into HashSet and check for duplicates.
27.02.2023
medium427. Construct Quad Tree
use inclusive ranges to simplify the code
26.02.2023
hard72. Edit Distance
Do DFS and use array for memoizing the result.
25.02.2023
easy121. Best Time to Buy and Sell Stock
we can just use current value as a max candidate instead of managing the max variable.
24.02.2023
hard1675. Minimize Deviation in Array
Use TreeSet to quickly access to the min and max elements.
23.02.2023
hard502. IPO
Sort items by increasing capital. Then, on each step, add all possible deals to the priority queue and take one best from it.
22.02.2023
medium1011. Capacity To Ship Packages Within D Days
To more robust binary search code
21.02.2023
medium540. Single Element in a Sorted Array
Let's write a binary search. For more robust code, consider
20.02.2023
easy35. Search Insert Position
For more robust code consider
19.02.2023
medium103. Binary Tree Zigzag Level Order Traversal
for zigzag, we can skip a boolean variable and track result count.
18.02.2023
easy226. Invert Binary Tree
Let's write a recursive one-liner.
17.02.2023
easy783. Minimum Distance Between BST Nodes
Let's write Morris Traversal. Store current node at the rightmost end of the left children.
16.02.2023
easy104. Maximum Depth of Binary Tree
Let's write a one-liner.
15.02.2023
easy989. Add to Array-Form of Integer
use linked list to add to the front of the list in O(1)
14.02.2023
easy67. Add Binary
keep track of the overflow
13.02.2023
easy1523. Count Odd Numbers in an Interval Range
fun countOdds(low: Int, high: Int): Int {
12.02.2023
medium2477. Minimum Fuel Cost to Report to the Capital
Use DFS and data class for the result.
11.02.2023
medium1129. Shortest Path with Alternating Colors
Start with two simultaneous points, one for red and one for blue. Keep track of the color.
10.02.2023
medium1162. As Far from Land as Possible
Add all land cells into BFS, then just run it.
9.02.2023
hard2306. Naming a Company
Group and multiply. Don't forget to remove repeating elements in each two groups.
8.02.2023
medium45. Jump Game II
use stack to store jumps
7.02.2023
medium904. Fruit Into Baskets
careful with corner cases
6.02.2023
easy1470. Shuffle the Array
For simplicity, use two pointers for the source, and one for the destination.
5.02.2023
medium438. Find All Anagrams in a String
To avoid checking a frequencies arrays, we can count how many frequencies are not matching, and add only when non-matching count is zero.
4.02.2023
medium567. Permutation in String
to decrease cost of comparing arrays, we can also use hashing
3.02.2023
medium6. Zigzag Conversion
Store simulation result in a [rowsNum][simulation indice] - matrix, then build the result.
2.02.2023
easy953. Verifying an Alien Dictionary
Just translate and then sort and compare. (But we can also just scan linearly and compare).
1.02.2023
easy1071. Greatest Common Divisor of Strings
We can first find the length of the greatest common divisor, then just check both strings.
31.01.2023
medium1626. Best Team With No Conflicts
We can use DFS to search all the possible teams and memorize the result in dp cache.
30.01.2023
easy1137. N-th Tribonacci Number
another way is to use dp cache
29.01.2023
hard460. LFU Cache
one thing to note, on each increaseFreq operation we are retrieving a random item from TreeMap, that increases time to O(log(F)), where F is a unique set of frequencies.
28.01.2023
hard352. Data Stream as Disjoint Intervals
careful with merge
27.01.2023
hard472. Concatenated Words
first, scan all the words, and fill the Trie
26.01.2023
medium787. Cheapest Flights Within K Stops
by the problem definition, path length is k+1, not just k
25.01.2023
medium2359. Find Closest Node to Given Two Nodes
fun closestMeetingNode(edges: IntArray, node1: Int, node2: Int): Int {
24.01.2023
medium909. Snakes and Ladders
fun snakesAndLadders(board: Array
23.01.2023
easy997. Find the Town Judge
fun findJudge(n: Int, trust: Array
22.01.2023
medium131. Palindrome Partitioning
fun partition(s: String): List> {
21.01.2023
medium93. Restore IP Addresses
fun restoreIpAddresses(s: String): List
20.01.2023
medium491. Non-decreasing Subsequences
fun findSubsequences(nums: IntArray): List> {
19.01.2023
medium974. Subarray Sums Divisible by K
fun subarraysDivByK(nums: IntArray, k: Int): Int {
18.01.2023
medium918. Maximum Sum Circular Subarray
fun maxSubarraySumCircular(nums: IntArray): Int {
17.01.2023
medium926. Flip String to Monotone Increasing
fun minFlipsMonoIncr(s: String): Int {
16.01.2023
medium57. Insert Interval
fun insert(intervals: Array
15.01.2023
hard2421. Number of Good Paths
fun numberOfGoodPaths(vals: IntArray, edges: Array
14.01.2023
medium1061. Lexicographically Smallest Equivalent String
fun smallestEquivalentString(s1: String, s2: String, baseStr: String): String {
13.01.2023
hard2246. Longest Path With Different Adjacent Characters
fun longestPath(parent: IntArray, s: String): Int {
12.01.2023
medium1519. Number of Nodes in the Sub-Tree With the Same Label
fun countSubTrees(n: Int, edges: Array
11.01.2023
medium1443. Minimum Time to Collect All Apples in a Tree
fun minTime(n: Int, edges: Array
10.01.2023
easy100. Same Tree
fun isSameTree(p: TreeNode?, q: TreeNode?): Boolean = p == null && q == null ||
9.01.2023
easy144. Binary Tree Preorder Traversal
class Solution {
8.01.2023
hard149. Max Points on a Line
fun maxPoints(points: Array
7.01.2023
medium134. Gas Station
fun canCompleteCircuit(gas: IntArray, cost: IntArray): Int {
6.01.2023
medium1833. Maximum Ice Cream Bars
fun maxIceCream(costs: IntArray, coins: Int): Int {
5.01.2023
medium452. Minimum Number of Arrows to Burst Balloons
fun findMinArrowShots(points: Array
4.01.2023
medium2244. Minimum Rounds to Complete All Tasks
fun minimumRounds(tasks: IntArray): Int {
3.01.2023
easy944. Delete Columns to Make Sorted
fun minDeletionSize(strs: Array
2.01.2023
easy520. Detect Capital
fun detectCapitalUse(word: String): Boolean =
1.01.2023
easy290. Word Pattern
fun wordPattern(pattern: String, s: String): Boolean {
31.12.2022
hard980. Unique Paths III
fun uniquePathsIII(grid: Array
30.12.2022
medium797. All Paths From Source to Target
fun allPathsSourceTarget(graph: Array> {
29.12.2022
medium1834. Single-Threaded CPU
fun getOrder(tasks: Array
28.12.2022
medium1962. Remove Stones to Minimize the Total
fun minStoneSum(piles: IntArray, k: Int): Int {
27.12.2022
medium2279. Maximum Bags With Full Capacity of Rocks
fun maximumBags(capacity: IntArray, rocks: IntArray, additionalRocks: Int): Int {
26.12.2022
medium55. Jump Game
fun canJump(nums: IntArray): Boolean {
25.12.2022
easy2389. Longest Subsequence With Limited Sum
fun answerQueries(nums: IntArray, queries: IntArray): IntArray {
24.12.2022
medium790. Domino and Tromino Tiling
fun numTilings(n: Int): Int {
23.12.2022
medium309. Best Time to Buy and Sell Stock with Cooldown
data class K(val a:Int, val b: Boolean, val c:Boolean)
22.12.2022
hard834. Sum of Distances in Tree
fun sumOfDistancesInTree(n: Int, edges: Array
21.12.2022
medium886. Possible Bipartition
fun possibleBipartition(n: Int, dislikes: Array
20.12.2022
medium841. Keys and Rooms
fun canVisitAllRooms(rooms: List>): Boolean {
19.12.2022
easy1971. Find if Path Exists in Graph
fun validPath(n: Int, edges: Array
18.12.2022
medium739. Daily Temperatures
fun dailyTemperatures(temperatures: IntArray): IntArray {
17.12.2022
medium150. Evaluate Reverse Polish Notation
fun evalRPN(tokens: Array
16.12.2022
easy232. Implement Queue using Stacks
class MyQueue() {
15.12.2022
medium1143. Longest Common Subsequence
fun longestCommonSubsequence(text1: String, text2: String): Int {
14.12.2022
medium198. House Robber
fun rob(nums: IntArray): Int {
13.12.2022
medium931. Minimum Falling Path Sum
fun minFallingPathSum(matrix: Array
12.12.2022
easy70. Climbing Stairs
val cache = mutableMapOf
11.12.2022
hard124. Binary Tree Maximum Path Sum
fun maxPathSum(root: TreeNode?): Int {
10.12.2022
medium1339. Maximum Product of Splitted Binary Tree
fun maxProduct(root: TreeNode?): Int {
9.12.2022
medium1026. Maximum Difference Between Node and Ancestor
fun maxAncestorDiff(root: TreeNode?): Int {
8.12.2022
easy872. Leaf-Similar Trees
fun leafSimilar(root1: TreeNode?, root2: TreeNode?): Boolean {
7.12.2022
easy938. Range Sum of BST
fun rangeSumBST(root: TreeNode?, low: Int, high: Int): Int =
6.12.2022
medium328. Odd Even Linked List
// 1 2
5.12.2022
easy876. Middle of the Linked List
fun middleNode(head: ListNode?, fast: ListNode? = head): ListNode? =
4.12.2022
medium2256. Minimum Average Difference
fun minimumAverageDifference(nums: IntArray): Int {
3.12.2022
medium451. Sort Characters By Frequency
fun frequencySort(s: String): String =
2.12.2022
mediumDetermine If Two Strings Are Close
// cabbba -> c aa bbb -> 1 2 3
1.12.2022
easy1704. Determine if String Halves Are Alike
fun halvesAreAlike(s: String): Boolean {
30.11.2022
easy1207. Unique Number of Occurrences
fun uniqueOccurrences(arr: IntArray): Boolean {
29.11.2022
medium380. Insert Delete GetRandom O(1)
class RandomizedSet() {
28.11.2022
medium2225. Find Players With Zero or One Losses
fun findWinners(matches: Array> {
27.11.2022
hard446. Arithmetic Slices II - Subsequence
fun numberOfArithmeticSlices(nums: IntArray): Int {
26.11.2022
hard1235. Maximum Profit in Job Scheduling
fun jobScheduling(startTime: IntArray, endTime: IntArray, profit: IntArray): Int {
25.11.2022
medium907. Sum of Subarray Minimums
data class V(val v: Int, val count: Int)
24.11.2022
medium79. Word Search
fun exist(board: Array
23.11.2022
mediumValid Sudoku
fun isValidSudoku(board: Array
22.11.2022
mediumPerfect Squares
val cache = mutableMapOf
17.11.2022
mediumRectangle Area
class Solution {
16.11.2022
easyGuess Number Higher Or Lower
override fun guessNumber(n:Int):Int {
15.11.2022
mediumCount Complete Tree Nodes
x
14.11.2022
mediumMost Stones Removed With Same Row Or Column
From observing the problem, we can see, that the task is in fact is to find an isolated islands
13.11.2022
mediumReverse Words In A String
A simple trick: reverse all the string, then reverse each word.
12.11.2022
hardFind Median From Data Stream
To find the median we can maintain two heaps: smaller and larger. One decreasing and one increasing.
9.11.2022
mediumOnline Stock Span
So, we need to keep increasing sequence of numbers, increasing/decreasing stack will help.
8.11.2022
easyMake The String Great
The simplest solution is just to simulate all the process, as input string is just 100 symbols.
7.11.2022
easyMaximum 69 Number
The simplest implementations would be converting to array of digits, replacing the first and converting back.
6.11.2022
hardOrderly Queue
One idea that come to my mind is: if k >= 2 then you basically can swap any adjacent elements. That means you can actually sort all the characters.
6.11.2022
hardWord Search Ii
Use trie + dfs
4.11.2022
easyReverse Vowels Of A String
Straightforward solution : use two pointers method and scan from the both sides.
3.11.2022
mediumLongest Palindrome By Concatenating Two Letter Words
This is a counting task, can be solved linearly.
2.11.2022
mediumMinimum Genetic Mutation
make graph
1.11.2022
mediumWhere Will The Ball Fall
This is a geometry problem, but seeing the pattern might help. We can spot that each row is an action sequence: -1 -1 -1 shifts balls left, and 1 1 1 shifts balls to the right. Corners can be formed only with -1 1 sequence.
31.10.2022
easyToeplitz Matrix
just compare adjacent rows, they must have an equal elements except first and last