This repository contains the solutions and explanations to the algorithm problems on LeetCode. Only medium or above are included. All are written in C++/Python and implemented by myself. The problems attempted multiple times are labelled with hyperlinks.
N/A Kth Smallest Sum In Two Sorted Arrays.java Hard [] Java 111 N/A Longest Common Substring.java Medium [DP, Double Sequence DP, Sequence DP, String] Java 112 N/A Rotate Image.java Medium [Array, Enumeration] Java 113 N/A Backpack III.java Hard [Backpack DP, DP] Java 114 N/A ...
Other Similar LeetCode Problems Merge Sort - 148 Quick Sort - 912 Majority Element - 169 Kth Largest Element in an Array - 215 Median of Two Sorted Arrays - 4 Merge k Sorted Lists - 23 Divide Two Integers - 29 Pow(x, n) - 50 Guess Number Higher or Lower II - 375 Dungeon Game -...
Merge K Sorted Arrays Set Matrix Zeroes GCD Queries - Greatest Common Divisor Problem Google Contests Competitive Programming Coding Problems Leetcode Problem Solution Count Number of Nodes in a Complete Binary Tree (Leetcode Problem Solution)
Additionally, it provides methods for creating trees based on given val values and constructing trees from level-order traversal arrays. This class serves as a helpful tool for developers tackling tree-related challenges on LeetCode by offering a standardized approach to tree representation and ...
【摘要】 截止至今LeetCode题目总量已经有1582题,估计将来每年平均增长300题左右,大部分人肯定是刷不完的,所以得有选择地刷LeetCode。 一种公认的刷题策略是按类别刷题,可是每个类别也有许多题,在... 截止至今LeetCode题目总量已经有1582题,估计将来每年平均增长300题左右,大部分人肯定是刷不完的,所以得有选择地...
350 intersection of two arrays2: simple problem. 360 sort transformed array: two pointers, but this time, based on the relative value of function(i) and function(j) we move different pointer each time. 424: longest repeating character replacement: the general idea is pretty simple, but have...
LeetCode in Python: Algorithms Coding Interview Preparation 总共29 小时更新日期 2025年4月 评分:4.5,满分 5 分4.520,639 当前价格US$10.99 原价US$74.99 LeetCode in Java: Algorithms Coding Interview Questions 总共39 小时更新日期 2025年4月 评分:4.5,满分 5 分4.599,736 当前价格US$10.99 原价US$74.99...
Arrays.sort(s, Comparator.comparingInt(e->e[0]));intans = 0;intmax = 5000;//dp[i]: the number of ways to achieve sum i from the Bint[] dp =newint[max + 1];//there is 1 way to achieve sum of 0, not picking any numbers from Bdp[0] = 1;for(inti = 0; i < n; i...
https://leetcode.com/problems/combination-sum-iv/ Note: The combination sum IV in leetcode shares the same DP model and solution with this kind of Backpack problem. publicclassSolution {publicintcombinationSum4(int[] nums,inttarget) {int[] dp =newint[target+1];//how to undestand dp[0]...