摘要:
链接: https://oj.leetcode.com/problems/majority-element/LeetCode给的这道题的解答真的不错:Runtime: O(n2) — Brute force solution: Check each element if it is the majo... 阅读全文
摘要:
链接: https://oj.leetcode.com/problems/find-peak-element/题目要求复杂度在对数级以内对数组下标进行二分搜索,public class Solution{ public int findPeakElement(int [] num) { int l... 阅读全文
摘要:
链接: https://oj.leetcode.com/problems/minimum-path-sum/简单的动态规划.[i][j]表示到达位置(i,j)时的最小sumpublic class Solution{ public int minPathSum(int[][] grid) { in... 阅读全文